13
我一直在試圖用新的角度1.5 component
語法項目,但我無法弄清楚如何注入依賴到的組件定義。角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的一部分。
如何做到這一點的部件上,因爲組件定義不是一個功能?
完美!我沒有想到將templateUrl變成一個函數。 – epb