Passing value from one component to the other in html using angular js ng-init

71 Views Asked by At

I tried doing the above thing using ng-init but I guess the scope of ng-init did not allow me to do so.

Lets suppose, I have a dropdown getting populated with a ng-repeat from an array having values q,a,b. I use the ng-if and check for the value of the dropdown to be q in the scope of this ng-repeat.

Similarly I want to check if this dropdown's current value is set as q outside this ng-repeat and populate something on the screen.

I tried using ng-init inside in a tag in the scope of ng-repeat and stored the value from the dropdown array in a scope variable and tried checking it outside this ng-repeat, this did not work out.

Can you please suggest why this did not work out and what can be a better solution to this problem without writing a single line of code in the controller rather working this out completely in the HTML

0

There are 0 best solutions below