【发布时间】:2017-04-04 01:54:48
【问题描述】:
我有两个有很多交叉引用的组件。我决定让它们相互依赖:
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!
我该如何解决?它是好的建筑吗?你会推荐什么?
【问题讨论】:
-
两个组件都没有另一个组件作为父组件。他们是兄弟姐妹。
标签: javascript angularjs components