-1
我有一个HTML和JS脚本。使用Angular填充对象
我想填充我的对象在第二个控制器的值与我的HTML页面的文本字段输入,也有一个添加按钮来填充点击对象并相应地更改插槽号。
到目前为止,我可以读取对象,如何在点击时添加我的html中的值,并且每次增加一个插槽号?
脚本
.controller('second', function($scope) {
$scope.items = {
"c_name": "Name of the campaign",
"max_slots": 1,
"d_text": ["age", "gender", "name"],
"slots": [
{
"slot_id": 1,
"path_image": "path",
"base_image": "base 64 image",
"age": 25,
"gender": "your Gender",
"name": "your name"
}
]
}
});
HTML
<div ng-controller="second">
<div ng-repeat="(key, values) in items">
{{key}}
<div ng-repeat="item in values">
{{item.name}}
</div>
</div>
<!-- each time click add increment slot number -->
<button>add</button>
使用'NG-click'指令 – Zooly