javascript - 角度js,使用模型添加数据并返回视图
问题描述
我有一个问题:我有标签列表,我可以添加标签。用于添加标签使用模式
我会重复我的标签列表。但是当我添加标签时,我会在我的 console.log 上看到它,但他不会在我的 ng 重复上打印:
我的代码:
$scope.createTag = function () {
apiREST.execute('POST', "ctrl", "tag",{datas: $scope.tag}, function (error) {
if(error == true){
Growl.error({title: 'ERROR', text: 'Need name value'});
}else{
Growl.success({title: "Success !", text: "Tag successfuly created !"});
}
$scope.getTags();
}, );
};
$scope.getTags = function() {
apiREST.execute("GET","ctrl","tag",{},
function (data) {
$scope.tags = data.TAGS;
console.log($scope.tags); // i see my new tag
},
function () {
console.log("error");
});
};
和我的看法
<div class="col-md-8 text-bold">
Tags
<br>
<i class="text-danger"> click on tags for select </i>
</div>
<div class="col-md-2 text-bold">
<button class="btn btn-info" id="" ng-click="openModalTagg();">
Add Tags
</button></div>
</div>
<br>
<div class="tagCss">
<span ng-repeat="ctc in tags" >
<button class="btn btn-primary tag" style="margin-top: 20px; font-size: 12px;" id='{{ctc.id_tag}}' ng-click="selectTag()" >{{ctc.name_tag}}</button>
</span>
</div>
泰为你的帮助
解决方案
推荐阅读
- python - 如何从解析网页中获取项目?
- vhdl - GHDL -fsynopsys 和 -fexplicit 选项
- json - 在核心数据中存储 JSON (Swift)
- graph - 使用存储在共享首选项中的值的片段中的图形
- hyperlink - 是否可以从 Epub 内的外部链接打开灯箱?
- android - TextField 中的文本问题 - Android Jetpack Compose
- unity3d - Unity URP 无法覆盖虚函数
- sql - WPF DataGrid 问题 - 在 RowDetailsTemplate 中引用文本框
- flutter - 我无法更改下拉按钮中的提示文本
- python - 如何使用 python 将 2.7 GB gct 文件转换为数据框?