我有两个组件有很多交叉引用。我决定让他们互相依赖: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