1
我写在下面的方式指令:角缩小安全
- 指令的.html(模板)
- DirectiveController .js文件(控制器)
- 指令的.js(指令)
DirectiveController.js:
function DirectiveController($scope) {}
个
Directive.js:
someModule.directive('directive', function() {
return {
restrict: 'E',
templateUrl: 'Directive.html',
controller: DirectiveController,
scope: {
data: '='
}
}
});
的问题是,我该怎么再缩小DirectiveController?提前
someModule.controller('someController',['$scope', function($scope) {} ]);
感谢
如果我理解正确,我可以写: DirectiveController。$ inject = ['$ scope']; 函数DirectiveController($ s){ }; ____它将第一个参数理解为注入的$ scope? –
是的,这是正确的。 –
谢谢,我会试试看。将更新结果。 –