我有兩個組件有很多交叉引用。我決定讓他們互相依賴:AngularJS:組件中的相互依賴關係
taskList
組件:
angular.module("todo-feature")
.component("taskList", {
templateUrl: "feature/todo-feature/todo_table.html",
controller: "Todo",
require: {
"parent": "paging"
}
});
paging
組件
angular.module("paging-module")
.component('paging', {
templateUrl: "feature/todo-feature/paging/paging.html",
controller: "PagingController",
require: {
"parent": "taskList"
}
});
index.html
:
<paging></paging>
<task-list></task-list>
它不工作。我收到兩個錯誤:
Controller 'paging', required by directive 'taskList', can't be found!
Controller 'taskList', required by directive 'paging', can't be found!
我怎樣才能解決這個問題?完全是好建築嗎?你會推薦什麼?
無論兩個組成部分沒有另外一個作爲父母。他們是兄弟姐妹。 – estus