我一直在尝试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
})
由于各种原因,我们将常量basePath
作为 templateUrl 的一部分注入到所有指令中。
由于组件定义不是函数,我该如何在组件上执行此操作?