这里发生了什么?
这是我的指令:
// template <input ng-model="theModel" />
app.directive('bseInput', function () {
return {
templateUrl: "/Scripts/bse/bse-inputs.html",
scope:
{
theModel: '=',
},
compile: function compile(tElement, tAttrs, transclude) {
// do stuff
}
};
});
app.directive('submitRequired', function (objSvc) {
return {
require: 'ngModel',
link: function (scope, elm, attrs, ctrl) {
// do something
}
};
});
Run Code Online (Sandbox Code Playgroud)
以下是使用中的指令示例:
<input bse-input submit-required="true" the-model="someModel"></input>
Run Code Online (Sandbox Code Playgroud)
这是实际的错误文本:
错误:[$ compile:ctreq]无法找到指令'submitRequired'所需的控制器'ngModel'! http://errors.angularjs.org/1.2.2/ $ compile/ctreq?p0 = ngModel&p1 = submitRequired at http://www.domain.ca/Scripts/angular/angular.js:78:12 at getControllers(http ://www.domain.ca/Scripts/angular/angular.js:5972:19)在compositeLinkFn(http://www.domain.ca/Scripts/angular/angular.js:6139:35)的compositeLinkFn(http) ://www.domain.ca/Scripts/angular/angular.js:5550:15)在compositeLinkFn( …