Is there a way to pass data from the Main Controller (index) to the Sub Controller (Component)? In this scenario, instead of hardcoding the url
, I want to send the parameters for the Title
and the URL
from the main controller to the component. I'm encountering difficulties with sending this information and troubleshooting where the issue lies.
index.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;
}