如何将数据从父控制器(索引)发送到子控制器(组件)。请参阅示例,而不是硬编码,url
我想将参数Title
从URL
页面控制器发送到组件。我坚持发送它,我不知道问题出在哪里。
索引.html
<div>
<my-list obj="vm.obj"></my-list>
</div>
index.controller.js
this.obj = {
testURL: "AngularJS",
testName: "Testing Environment
}
mylistComponent.html
<span>{{vm.myTestName}}</span>
<a href="https://en.wikipedia.org/wiki/{{vm.myTestURL}}">AngularJS Wikipedia</a>
mylist.Component.js
binding: {
obj: "="
}
this.goToPage = function() {
this.myTestName = this.obj.testName;
this.myTestURL = this.obj.testURL;
}