AngularJS checkbox ng-repeat and selected objects?

I have to override the categories each time the list is populated
since it will be pull out form server. So i quess i need to have
arrays and the second one will hold the selected objects?

Yes, since it is a list you can/should use arrays. The information about the selected items/objects should be stored on your scope model (example below).

If I am right, how do I preselected checkboxes?

Save the ID’s of the selected options/checkboxes on your model and let the ng-model do the rest.

Do I need ng-click in order call custom function to store the selected
object in the other array?

No, you don’t need it, ng-model is enough.

Do i need ng-model in check box? And what for?

Yes, you need it. The ng-model is responsible for storing the selected options on your model and for making the (‘pre-‘)selection automatic.

jsfiddle http://jsfiddle.net/bmleite/PQvQ2/

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)