我想在删除后再次添加标签到angular ui select2多项选择。
例如。如果我将删除一个标记并调用ajax,是否允许用户删除标记,如果不是,我想添加该标记。我在$ watch中调用ajax
<select ui-select2 data-placeholder="Pick Sports" multiple style="width: 100%;" name="sport_id" id="" ng-model="skillLevelForm.sport_id" required>
<option ng-repeat="sport in sports" value="{{sport.id}}">{{sport.name}}</option>
</select>
JS
$scope.$watch('skillLevelForm.sport_id', function(newV , oldV) {
$scope.skillLevelForm.sport_id.push(oldV);
});
这里oldV是一个id,我正在推回到ng-model skillLevelForm.sport_id。这可以在控制台日志中看到,但标签不会添加到ui中。 Plz帮助