這可能聽起來是newb,但我一直在關注這個tutorial的angularjs組件。angularjs 1.5組件依賴注入
我是新來的組件和如何注入常量Utils
或authService
像我這樣的組件?
app.component('tlOverallHeader', {
bindings: {
data: '='
},
templateUrl: 'js/indexTimeline/components/tl_overallHeader/templates/tl_overallHeader.html',
controller: function() {
this.ms = 'tlOverallheader!'
}
})
謝謝!
在ES6需要將參數分配給本地變量的情況下添加 'class FranchisesController {$ state = {state} { this。$ state = $ state; } addFranchise(){ this。$ state.go('franquicias.agregar'); } }' – elporfirio
你從哪裏找到這個?我無法在https://docs.angularjs.org/guide/component上的文檔中找到它。乾杯 –
@NickWhiu你可以在依賴注入部分找到它 - https://docs.angularjs.org/guide/di – Gondy