新增时会将前面新增的值置空
<form role="form" name="keywordsForm" novalidate><div class="form-group">
<label class="col-sm-3 control-label" ng-cloak>{{cityNameSel}}地区关键字:</label>
<p class="col-sm-3 col-sm-push-8">
<button type="button" class="btn btn-success btn-sm" ng-click="addKw()"><span class="glyphicon glyphicon-plus"></span></button>
</p>
</div>
<div class="clr"></div>
<div class="form-group kwlist">
<div class="col-sm-2" ng-repeat="kw in kwlist track by $index" ng-mouseenter="showDelete=true" ng-mouseleave="showDelete=false">
<input type="text" name="keywords{{$index}}" class="form-control" ng-model="kw" required/>
<span class="glyphicon glyphicon-remove delete" ng-show="showDelete" ng-click="delete($index)"></span>
<span class="tips" ng-show="keywordsForm.keywords{{$index}}.$dirty && keywordsForm.keywords{{$index}}.$invalid">
<span ng-show="keywordsForm.keywords{{$index}}.$error.required"><span ng-bind="'请输入关键字或者删除。'"></span></span>
</span>
</div>
</div>
<div class="clr"></div>
<div class="btn btn-lg btn-danger fr" ng-disabled="keywordsForm.$invalid" ng-click="subKw()">提交</div>
</form>
请问是什么情况呢 数据是数组类型的 解决方法是将数组类型的数据转成对象类型进行处理
[{"name":"北京"},{"name":"河北"}]
页:
[1]