angularjs-ng-repeat

Calcuate Sum in ng-repeat when Value Change

故事扮演 提交于 2020-01-05 04:00:50
问题 When Value Changes i want to Calcualte the Sum <tr ng-repeat="act in ctrl.otsact.tests" ng-if="ctrl.editToggle"> <td> <md-input-container> <input type="text" ng-model="act.test_date" class="dateField" aria-label="Test Date"> </md-input-container> </td> <td ng-repeat="sub in act.subjects" > <md-input-container> <input type="number" ng-model="sub.score" aria-label="Score"> </md-input-container> </td> <td class="composite"> 100 </td> <td><span ng-click="ctrl.removeOTSACT(act.id)"> x </span></td>

Why are my ng-repeat items not filtering as expected here?

我是研究僧i 提交于 2020-01-04 13:44:46
问题 Plnkr: http://plnkr.co/edit/Q34J9szbLeGgc4jkcNUM?p=preview I have a simple Array called tags, which contains 4 objects with a tweets value and vol value. When I click the Order by Tweets , or Order by Vol buttons I expect the numbers to make sense, like going from high to low or low to high, but the numbers are out of order. Markup: <div class="sidebar" ng-controller="sidebar"> <header class="my-header"> <button ng-click="reOrderByTweets()">Order by Tweets</button> <button ng-click=

Why are my ng-repeat items not filtering as expected here?

烈酒焚心 提交于 2020-01-04 13:43:23
问题 Plnkr: http://plnkr.co/edit/Q34J9szbLeGgc4jkcNUM?p=preview I have a simple Array called tags, which contains 4 objects with a tweets value and vol value. When I click the Order by Tweets , or Order by Vol buttons I expect the numbers to make sense, like going from high to low or low to high, but the numbers are out of order. Markup: <div class="sidebar" ng-controller="sidebar"> <header class="my-header"> <button ng-click="reOrderByTweets()">Order by Tweets</button> <button ng-click=

Angular - multiple ng repeat in table

≯℡__Kan透↙ 提交于 2020-01-04 13:28:53
问题 [EDIT : Solved but i think there's a better way, if you find it, i'm still interested] I have a list of banks. Each bank contains a list of accounts. Each accounts contains a list of operations. I would like to display all the operations in a table. Here's what the bank list looks like : $scope.banks = [ { id: 1, name: 'bank_1', accounts: [ { id: 1, name: 'account_1', operations: [ {id: 1, name:'operation_1', price:100}, {id: 2, name:'operation_2', price:200}, {id: 3, name:'operation_3',

Angular - multiple ng repeat in table

本秂侑毒 提交于 2020-01-04 13:27:26
问题 [EDIT : Solved but i think there's a better way, if you find it, i'm still interested] I have a list of banks. Each bank contains a list of accounts. Each accounts contains a list of operations. I would like to display all the operations in a table. Here's what the bank list looks like : $scope.banks = [ { id: 1, name: 'bank_1', accounts: [ { id: 1, name: 'account_1', operations: [ {id: 1, name:'operation_1', price:100}, {id: 2, name:'operation_2', price:200}, {id: 3, name:'operation_3',

Finding an ng-repeat index?

邮差的信 提交于 2020-01-04 10:39:31
问题 I can do this in Angular.js: <tr ng-repeat="cust in customers"> <td> {{ cust.name }} </td> </tr> Which would iterate through all the customers by putting each in a <tr> of its own. But what if I wanted two customers in one <tr> ? How would I accomplish that? I normally do that by messing around with indexes and modulus values, but I'm not sure how to do that here. 回答1: It turns out this can be done without any custom filters or changing the format of your data, though it does require some

How to filter through a table using ng-repeat checkboxes with Angularjs

戏子无情 提交于 2020-01-04 00:10:52
问题 Once upon a time this was working but somehow it's broken. I want to be able to produce checkboxes using ng-repeat to get as many checkboxes as required based on stored data and use these to filter through a table produced. Additionally I don't want identical values for the checkboxes to be repeated. I have made a plnkr with the code. <div class="row"> <label data-ng-repeat="x in projects"> <input type="checkbox" data-ng-true-value="{{x.b}}" data-ng-false-value='' ng-model="quer[queryBy]" />

Getting Angular ng-class to $apply before an ng-repeat animation

浪尽此生 提交于 2020-01-03 17:29:54
问题 I have an animation that animates an element in an ng-repeat to the left or right depending on which button is clicked. In one manoeuvre, I set a ng-class (the animation class) and then remove the element, which triggers the animation, but it doesn't seem to recognise the change to the ng-class before the animation is applied, unless I use a $scope.$apply() , but this throws up a $apply already in progress error. Is there a way to not have to use the $scope.$apply() , or to get rid of that

ng-repeat sorting is throwing an exception in jQuery

岁酱吖の 提交于 2020-01-03 17:16:10
问题 I have a table with rows created by ng-repeat. Table headers have an ng-click that sets the predicate for the sorting (the function also determines direction, asc/desc). The sorting works fine, but for some reason I get exceptions from jQuery every time I change the predicate and the sort fires. Here is a plunkr example of what I am doing : http://plnkr.co/edit/qfNcm9RPQSsNgqmm3TYS?p=preview As you can see in the plnkr, the ng-repeat is pretty simple. The ng-repeat in our project is similar

ng-repeat over array of objects vs. object containing objects

倖福魔咒の 提交于 2020-01-03 06:40:12
问题 In almost all the examples of ng-repeat I've seen, the data is structured like so: $scope.dataCollected = [{name: bob, data: '10-12-12'}, {name:joe, data: '09-13-13'}]; However, the only way I can get ng-repeat to work is if I structure the data like this: $scope.dataCollected = {bob: {name: bob, data: '10-12-12'}, joe: {name:joe, data: '09-13-13'}}; Structuring it as an array causes the ng-repeat to do absolutely nothing. It doesn't even give an error. Structuring it as an object containing