Create common controls as Angular Directive (Dropdown / select list)

You can create state/country dropdown list as common controls to make use of them as global controls instead of re-creating for each controller.

http://plnkr.co/edit/V5ub3CBRMlQcjGMs2Px2?p=preview

Ref: http://stackoverflow.com/questions/18459681/how-add-options-to-a-select-with-an-angularjs-directive


For Two-way binding working from/to directive, need to use controller in directive instead of link function.

Fiddle https://jsfiddle.net/vpavulu/h2ng6wdw

Another way to make 2-way binding to work with Button & Unordered list as dropdown list -

http://plnkr.co/edit/mIKHqMixUALMR8DA18Vh

Comments

Popular posts from this blog

Windows Azure Package Build Error: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

Resource ID : 1. The request limit for the database is 180 and has been reached.

How to get Client's Location using IPAddress