I have created AngularJS dependable dropdowns, its working fine with static data from script file. Now how can I bind data to these dropdowns from an URL. I don't have a separate url for dropdowns, there is one url delivering everything.
How should I parse the data to get the required output? Iam very new to this, Will be grateful if anyone can help!!
First working Punker here:
http://plnkr.co/edit/okKOeQViflRseqrOYeOY?p=preview
The problem is your question states something and your demo shows something else.
You can directly parse the JSON data on fly using angular then you don't have
ng-change
function to detect which dropdown was selected. Refer to the below code on how I'm parsing the data inhtml
itself.next your second dropdown which is STATE doesn't trigger on change even if the scope is changed.
So use a
$watch
to see the changes to scope when it happens apply it to the CITYSo your js:
PS: The above plunker isn't very perfect you may some some minor issues which you should be able to solve.