Dynamic Model


#1

I am getting data from a webservice, from which I have to create dynamic <select>. i.e. model should be created dynamically in the controller and binded to the <select>. e.g from the attached image I need to create 2 <select> one for Processor and another for RAM with the <option> highlighted in green and should be able to get the selected values back in controller. Can someone advice on this?


#2

@adgetz, you can create a factory which holds the “keys” of your tags.

I.e., in your factory you will have the keys “Processor” and “RAM”. Then, when you retrieve your objects from the webservice, you can go over all of them with underscore.js (UnderscoreJS website) and get the relevant objects for each key.

You can use _.filter or _.where to prepare your objects to put in the tags.

Hope I helped. Here to give more advices :smile: