我一直在尝试component在项目中使用新的Angular 1.5 语法,但我无法弄清楚如何将依赖项注入组件定义.
这是我尝试将现有指令重构为组件:
angular
.module('app.myModule')
.component('row', {
bindings: {
details: '@',
zip: '@'
},
controller: 'RowController',
templateUrl: basePath + 'modules/row.html' // basePath needs to be injected
})
Run Code Online (Sandbox Code Playgroud)
由于各种原因,我们将常量basePath作为templateUrl的一部分注入到我们的所有指令中.
如何在组件上执行此操作,因为组件定义不是函数?