ng-repeat

Multiple Iterations with AngularJS ng-repeat

江枫思渺然 提交于 2020-01-16 02:09:26
问题 I've searched for a while and did find a lot about multiple iterations. The problem is that i don't see a plain solution for my problem. I have a list of checkbox that is filled dinamically with ng-repeat. Due to layout purposes i need to create a new div inline-block whenever i reach 3 checkboxes. Like that: CheckBoxList = {1,2,3,4,5} <div class="form-group-content"> <div class="form-col-secondary"> <ul class="list-checkboxes"> <li> <input type="checkbox"/>1 </li> <li> <input type="checkbox"

AngularJS ng-repeat creating three empty rows whien populating table & ng-repeat not repeating

佐手、 提交于 2020-01-13 19:34:19
问题 I've looked for solutions to these problems, but Angular is very foreign syntax for me, and every method seems to do a lot behind the scenes. I'm a newb to web development and this is my first project consuming an API, using AngularJS, and I just started to explore JavaScript. From my understanding, this is what I have accomplished so far. AngularJS gets the JSON data from a BitBucket API, Angular then creates a JavaScript object to access arrays of data. Here's the controller.js and index

Angularjs v1.2.1 - ng-repeat animation - animation classes are not removed

早过忘川 提交于 2020-01-13 07:10:28
问题 I wrote a directive which displays a list of elements. After list change the old list moves to the left followed by the new one. To achieve this behavior use ng-repeat directive and css3 transitions. I noticed that animations classes( ng-animate ng-enter ng-animate-start ng-animate-active ng-enter-active ) are not beeing removed after animation end and the old node ceated by ng-repeat loop is also not removed. Example in plunker: http://plnkr.co/edit/gqRIIUJF55NNvlt9lqMz?p=preview The problem

angularjs very slow fetching ng-repeat data from a json file

拜拜、爱过 提交于 2020-01-13 04:32:26
问题 I have a json file which has about 8000 contacts in it, fetching all that data takes a very long time with angularjs using ng-repeat, is there any fix for this? 回答1: You cannot expect much speed when retrieving such large records. You can optimize the ng-repeat performance by using Track by BindOnce Infinite Scroll These things will improve the performance to an extent. 来源: https://stackoverflow.com/questions/24261331/angularjs-very-slow-fetching-ng-repeat-data-from-a-json-file

How to access the index of super parent in nested ng-repeats

天涯浪子 提交于 2020-01-06 06:36:08
问题 I want to access the index of the outermost ng-repeat. <div ng-repeat=""> <div ng-repeat=""> <div ng-repeat=""> //I want to get the $index of outer ng-repeat here </div> </div> </div> 回答1: Use ng-init to set the outer index: <div ng-repeat="" ng-init="outerIndex = $index"> Then you can use outerIndex in the other scopes. Angular documentation has this example specifically 回答2: A nice clean way to do this is with ng-init <div ng-repeat="" ng-init="indxFirst = $index"> <div ng-repeat="" ng-init

ng-change does not work in the table row generated by ng-repeat

可紊 提交于 2020-01-06 01:57:08
问题 I have a simple table row. The row is generated by below code. <tr ng-init="cacheChanged"> <td>Expiration Period</td> <td ng-repeat="system in tableData.regions[0].systems"> <input type="text" ng-model="system.cacheDuration" ng-change="cacheChanged=true"> <span>h</span> </td> <td> <button type="button" ng-click="saveCache()" ng-disabled="!cacheChanged">Save</button> </td> </tr> When any of the four values changed, the save button is supposed to be enabled. However, it is still disabled all

Using ng-repeat on multiple arrays

你说的曾经没有我的故事 提交于 2020-01-04 14:15:27
问题 I'm making a weather application but I'm stuck on what should be a simple task but I can't wrap my head around how this works since I'm new to Angular. Basically what I need is to iterate over two arrays at once and set some values from this array. In theory this is what I wanna accomplish: <div ng-repeat="city in cities" ng-repeat="temp in temperatures" id={{city.id}}> <span>{{temp}}</span> </div> But obviously you can't put multiple repeaters like this. If I put an ng-repeat on the span I

ng-repeat filter null value not displaying

ぃ、小莉子 提交于 2020-01-03 13:57:50
问题 Why won't angular display values that are null when I apply: ng-repeat="p in foo | filter: filter2" where filter2 is $scope.filter2 = function(p){ if (p.state === null){ return p.state; } else{ return; } }; here's a plnkr with what I'm saying: http://plnkr.co/edit/cj3v1fuBu6sHVI7A4qlq?p=preview The filter works when it's anything but a null but I'm trying to only the null ones to display. I could try changing all the null values to a default value string other than a null? Is there anywhere

Apply logic to every element in an ng-repeat upon ng-click (AngularJS)

半腔热情 提交于 2020-01-03 05:00:07
问题 I'm trying to build a media library in which only one image can be selected at a time. To do this, I have a list generated with AngularJS's ng-repeat function. So far, when I click on an element, it adds a highlighting class to a child div and toggles the visibility of a child form element. How can I make the click do the opposite for every other element in the ng-repeat? <li ng-click="show=!show" ng-repeat="media in media"> <div ng-if="show" class="selected"> <input class="bulk-check" type=

How to parse HTML in ng-repeat in angular.js [duplicate]

一曲冷凌霜 提交于 2020-01-02 07:08:19
问题 This question already has answers here : With ng-bind-html-unsafe removed, how do I inject HTML? (10 answers) Closed last year . I need to parse optional HTML from my model in ng-repeat. I have a repeater in a .jade template like this: tr(ng-repeat='car in cars') td(class='arrived-{{car.arrived}}') {{car.number}} td(class='arrived-{{car.arrived}}') {{car.location}} my car.location can be plain text like: City name or it can have some html in it, like this: In transit, <a href="http://example