0
我想创建一个指令像这样如何绑定值传递给自定义指令
<input ng-model="service" check-service="{{items}}" />
所以每次值在此输入修改,我想任何对象的最新值检查内部约束 - 服务即物品的最新价值。我有这样的,但不能确定基本的指导我如何能得到最新的值
.directive('checkService', ['$http', function($http) {
return {
require: 'ngModel',
link: function(scope, ele, attrs, c) {
scope.$watch(attrs.ngModel, function(newVal) {
// how to get latest value of {{items}} here?
}
}
});
不,我没有在checkService中传递相同的值服务。里面的checkService它绑定到不同的对象 – FarazShuja 2014-10-20 17:54:22
总之,每当这个输入的模式改变时,我想检索项目的最新值 – FarazShuja 2014-10-20 18:00:04