Posts

Showing posts from May, 2016

Country State Dropdown dependency - AngularJS

Image
Its been some time since I have written in this blog. Its mainly because of my work schedule. Cutting short personal note, let me introduce the problem. I have a plain HTML page which has two drop-down which is my interest in the article. The first one is Country, second one is Region/State. My requirement is to change the Regions when Country is selected/changed. I was trying to implementing this on my own, rather than trying to use features provided by AngularJS. Then with this stackoverflow thread, I was blown out. It was as simple as a filter clause in ng-options. I had never ever dreamed of anything simpler. Of course in my JSON, region data has a country id which made this approach simpler. Let me share my JSON. {     "states": [     {             "id": 1,             "code": "KAR",             "name": "Karnataka",           ...