【发布时间】:2015-09-25 09:52:52
【问题描述】:
将<select> 与自定义指令一起使用,我想在值更改时运行一个函数。
html
<select name="user_type" ng-model="user_type" user-type ng-change="check_type()">
指令
gb_dash.directive('userType', function(){
return{
restrict: 'A',
require: '^ngModel',
scope:{
check_type: '&'
},
link: function(scope, elem, attrs){
scope.check_type = function(){
console.log('changed');
}
}
}
});
【问题讨论】:
标签: javascript html angularjs angularjs-directive