angularjs-ng-repeat

How to make angularJS ng-model work with objects in select elements?

妖精的绣舞 提交于 2019-12-03 10:16:40
I have a problem with ng-model on a select element when passing an object from option elements. So, imagine we have an array of columns from a table called columns (the table's definition) and we'd like to creat some filters upon this definition var columns = [ {name: 'Account ID', type: 'numeric'}, {name: 'Full name', type: 'text'}, {name: 'Date of birth', type: 'date'}, {name: 'Active', type: 'boolean'} // and so on ]; var filters = [{}]; HTML: <div class="form-field" ng-repeat="filter in filters"> <select ng-model="filter"> <option value="" disabled>Choose filter</option> <option ng-repeat=

AngularJS & JSON - Obtain Value from Previous & Next Object

蓝咒 提交于 2019-12-03 09:09:30
Background: I have created an AngularJS test app which, obtains data from a JSON file, which is separated into categories and within each category is an employee card which is displayed through ng-repeat. These categories can then be viewed utilising a slider (using bxSlider). Aim: With bxSlider you can use custom Next/Previous buttons, what I wanted to achieve was to dynamically display the relevant category names in the Next/Previous buttons (please see annotation link below - my level does not allow me to post images). Website Category Slider Wireframe For example: the current category on

How ngRepeat works in angularjs?

荒凉一梦 提交于 2019-12-03 08:59:25
I'm preparing a presentation for a talk so I drew a diagram on how ngRepeat works. The focus of the talk is ngRepeats role in performance pitfalls but I'm not sure if everything is right in the diagram or if I missed something. Are there more loops in ngRepeat that could affect the performance, how does a change in the filter with a model affect the reevaluation of the ngRepeat(does it just trigger the watch the same way as the model/array change ?) 来源: https://stackoverflow.com/questions/28744328/how-ngrepeat-works-in-angularjs

AngularJS set initial active class

梦想的初衷 提交于 2019-12-03 08:49:16
I'm using Bootstrap tabs with an Angular ng-repeat . The problem I'm running into is that the first li and the first div.tab-pane each need an active class. Bootstrap takes care of that after a tab is clicked but, as you can see, not on load. My question is, how can I set an active class on the first li and div.tab-pane ? Demo: http://jsfiddle.net/FQgHx/ All you have to do is put an ng-class directive on the tab and tab pane that you would like active initially. You can change the expression from $index == 0 in the ng-class directive to whatever you would like. This could use a function or

Angular filter and order elements on click

。_饼干妹妹 提交于 2019-12-03 08:46:30
问题 I'm trying to filter a list of items (grabbed from JSON) onclick. I pull the data once from the server then would like to filter/order the elements using Angular. Here is my plunker: http://plnkr.co/edit/glSz1qytmdZ9BQfGbmVo?p=preview Tabs -- How could I filter/sort the items onclick? "Recent" would be sorted by date and "Popular" would be sorted by views. Categories -- I'm using ng-click to grab the category value although not sure how to update the filter dynamically (using the value passed

How to save Firebase objects $asArray() with angularFire, when the objects contain ng-repetate

别等时光非礼了梦想. 提交于 2019-12-03 08:36:49
I recently switched from angularfire 0.6 to to 0.8.0. I am having problems to save an item of a list, that contains an array itself. My Objects account look like this: { "-JQruasomekeys0nrXxH" : { "created" : "2014-03-23T22:00:10.176Z", "durations" : [ { "$$hashKey": "00L", // this is generated by ng-repeat on arrays "end" : "2014-07-15T22:00:00.000Z", "start" : "2014-07-09T22:00:00.000Z" } ], "email" : "some@mail.net", } } The durations are an array of time periods with start and end, which are resembled by a ng-repeat of two input fields in HTML. <tr ng-repeat="duration in account.durations"

Angular ng-repeat causes flickering

こ雲淡風輕ζ 提交于 2019-12-03 08:36:03
问题 I'm displaying a list of thumbnails with this code: <div class ="channel" ng-repeat ="channel in UIModel.channels" ng-class ="{evenchannel: ($index % 2) == 0, oddchannel: ($index % 2) == 1}"> <img class="channel-img" ng-src ="data/channels/{{$index + 1}}/thumb"/> </div> In the controller I have an ajax request which grabs new thumbnail images. Angular thus updates the images but causes flickering. Is there a way to double buffer or not have the list deleted in the process of updating the DOM?

AngularJS 1.2 - ngAnimate not working

给你一囗甜甜゛ 提交于 2019-12-03 07:42:24
问题 I am new to using ng-animate with AngularJS 1.2. I am not sure why my ng-animate does not work a certain class name but works with the default for a simple fade in that I saw in an example. In this example, I try to set my ng-animate class to be 'animation': http://plnkr.co/edit/QWQUUVdcLmzLKRvVibqN?p=preview but when I use the default, and my class name for animations is just ".ng-enter" and ".ng-leave", the fade in animation seems to work fine. http://plnkr.co/edit/lEQhMwd6RWmsdmJbosu0?p

How can I use ng-click to dynamically reload ng-repeat data?

随声附和 提交于 2019-12-03 06:32:20
I have a page that contains an ng-repeat directive. The ng-repeat works when the page first loads, but I want to be able to use ng-click to refresh the contents of the ng-repeat . I have tried the following code but it doesn't work. Any suggestions? <div ng-click="loadItems('1')">Load 1st set of items</div> <div ng-click="loadItems('2')">Load 2nd set of items</div> ... <table> <tr ng-repeat="item in items">> // stuff </tr> </table> ItemsCtrl: $scope.loadItems = function (setID) { $http({ url: 'get-items/'+setID, method: "POST" }) .success(function (data, status, headers, config) { $scope.items

ng-repeat filter on boolean

最后都变了- 提交于 2019-12-03 06:27:44
问题 I am trying to filter on a boolean value in an ng-repeat. List of unregistered users: <h3>Unregistered Users</h3> <div ng-repeat="user in users | filter:!user.registered"> <div class="row-fluid"> <div class="span2"> {{user.name}} </div> </div> </div> List of registered users: <h3>Registered Users</h3> <div ng-repeat="user in users | filter:user.registered"> <div class="row-fluid"> <div class="span2"> {{user.name}} </div> </div> </div> Is there a good way to filter based on registered and