U
U
Umid2015-08-18 22:59:31
Angular
Umid, 2015-08-18 22:59:31

How to write a loop for an array, for Angular?

Hello, how to write, or is it possible to write a loop that would create elements for an array. To bring it to Angular via ng-Reapeat.
For example, you need to create an array:

$scope.phones  = [
    {'name' : 'Nexus',
     'snippet' : 'Lorem ipsum dolor sit amet, consectetur adipisicing elit.',
     'status': true},
    {'name' : 'HTC',
   	 'snippet' : 'Lorem ipsum dolor sit amet, consectetur adipisicing elit.',
   	 'status' : false},
   	{'name' : 'Huawei',
   	 'snippet' : 'Lorem ipsum dolor sit amet, consectetur adipisicing elit.',
   	 'status' : true}
  ];

But what would be inside the array already had a certain number of elements.
PS (So far I'm just learning to program, so I set myself such goals.
And I wanted to ask if there are any sites where you can practice your JS skills (with assignments)).
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2015-08-18
Protko @Fesor

To bring it to Angular via ng-Reapeat.

ng-repeat will create these elements for you.
You already have an array with a certain number of elements.

N
Nikolai Polukhin, 2015-08-20
@Gazaret

I think it's better to learn js first (for example , learn.javascript.ru here ), and only then start learning angular.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question