自定义指令抛出 - 错误:$ compile:ctreq缺少必需的控制器

时间:2018-05-29 14:39:14

标签: angularjs angularjs-directive

为什么当我使用ngModel作为require选项

时,require选项不会在我的指令中抛出错误

以下脚本正在运行

angular.module('myApp').directive('validNumber',[function(){
return{
    require:'ngModel',
    scope:{},
    link: function (scope ,element, attr, ngModel) {

    }
}}])      //here is my html <input ng-model="data" valid-number>

以下脚本无法正常工作原因?它会抛出编译错误缺少必需的控制器

angular.module('myApp').directive('validNumber',[function(){
return{
    require:'ngSandy',
    scope:{},
    link: function (scope ,element, attr, ngModel) {

    }
}}]) //here is my html <input ng-sandy="data" valid-number>

0 个答案:

没有答案