javascript - looping through a variable length with Angularjs templates? -
The car.images_length variable has a number, for example I know that car.images_length is the value because I have logged in using Javascript. This is a very newbie question, but I'm new to Angulus. Im trying to try, but I have no luck, this is my code: HTML You want to intersect at You must create a range function in your controller: "4" . Therefore, depending on the peak, 4 & lt; Li & gt; I want to intersect and create elements
& lt; Ul rn-carousel-Corcelle-buffer class = "image" ng-ripat = "image in car.images_leng" & gt; & Lt; Li & gt; & Lt; IMG src = "picture / car / {{index}} .jpg" & gt; & Lt; / Li & gt; & Lt; / Ul & gt; li elements, Code> UL
and lt; ul rn-carousel rn-carousel-buffered class = "image" & gt; & Lt; li ng- repeat = "number in range (0, car. dimension_length)" & gt; & Lt; Img src = "picture / car / {{number}} .jpg" & gt; & Lt; / Li & gt; & Lt; / Ul & gt; ng-repeat does not assume an array value, then you have to create an array, in the above sample I did that from 0 to length
$ scope.range = function (minimum, max) {var results = []; For (var i = min; i & lt; = max; i ++) results push (i); Return result; };
Comments
Post a Comment