How can I send the data from the Parent Controller (index) to the Child Controller (Component). Please see the example, instead of the hardcoding the
url
Title
URL
<div>
<my-list obj="vm.obj"></my-list>
</div>
this.obj = {
testURL: "AngularJS",
testName: "Testing Environment
}
<span>{{vm.myTestName}}</span>
<a href="https://en.wikipedia.org/wiki/{{vm.myTestURL}}">AngularJS Wikipedia</a>
binding: {
obj: "="
}
this.goToPage = function() {
this.myTestName = this.obj.testName;
this.myTestURL = this.obj.testURL;
}
In your plunker, by doing this :
<test-component value="vm.obj"> </test-component>
You put the value of obj
in the var value
. So in the child scope you can access to this value with the var value
not anymore with obj
.
Here is your plunker updated.