angularjs-ng-repeat

Improving nested ng-repeat + directive performance

江枫思渺然 提交于 2019-11-29 10:47:45
I have a horizontal month calendar that shows the activities for employees per day. Currently it's using a table with the following hierarchy/flow 1) Controller: Generate an array containing every day for that month based on the select month / year. A $scope.$watchCollection updates the array whenever year or month changes. As the code explains what I do better: <table class="table table-bordered table-condensed" ng-controller="PlanningOverviewController"> <tr> <th><input type="text" ng-model="employeefilter"/></th> <th colspan="7" ng-repeat="week in weeks"> {{week | weekheader}} </th> </tr>

ng-repeat orderBy object

此生再无相见时 提交于 2019-11-29 10:25:23
UPDATE: on my html page I'm using as the following: <section ng-repeat="template in templates"> <ng-include src="template"></ng-include> </section> but the problem is that I need specific file in certain order so is there a way I can control the way order is rendering? I'm trying to orderby an object how do I do that and I have searched online before posting it here. function MyCtrl($scope) { $scope.templates = { template_address: "../template/address.html", template_book: "../template/book.html", template_create: "../template/create.html" }; <div ng-app ng-controller="MyCtrl"> <ul> <li ng

How can I get all the selected objects of Checkboxes in AngularJS?

喜你入骨 提交于 2019-11-29 10:13:35
问题 I want to get all the selected objects of the checkboxes using AngularJS. Below is my code My view.tpl.html <tr ng-repeat="item in itemList"> <td> <input type="checkbox" ng-click="clickedItem(item.id)" ng-model="model.controller.object" {{item.name}} /> </td> My Controller $scope.itemList = [ { id:"1", name:"first item" }, { id:"2", title:"second item" }, { id:"3", title:"third item" } ]; $scope.selection = []; $scope.clickedItem = function(itemId) { var idx = $scope.selection.indexOf(itemId)

How do I properly ng-repeat through nested key value pairs in angularJS

此生再无相见时 提交于 2019-11-29 10:11:55
View live code: Angular JS How in the world do I properly loop through nested key value pairs and properly output them like below? View I want is a tree like so -touts -classes -col-12 -col-md-12 -col-lg-12 Currently the view is: touts {"classes":["col-12","col-md-12","col-lg-12"]} JS: var currentApp = angular.module('currentApp', []); currentApp.controller('ACtrl', function($scope){ $scope.templates = { 'touts' : [ { 'classes' : ['col-12', 'col-md-12', 'col-lg-12' ] } ] }; }); HTML: <div ng-app="currentApp"> <div ng-controller="ACtrl"> <ul ng-repeat="(key, prop) in templates"> <li>{{key}}</li

Angular ng-repeat with nested json objects?

北战南征 提交于 2019-11-29 08:25:19
问题 I have a JSON object, represented as such: { "orders" : [ { "ordernum" : "PRAAA000000177800601", "buyer" : "Donna Heywood" "parcels" : [ { "upid" : "UPID567890123456", "tpid" : "TPID789456789485" }, { "upid" : "UPID586905486090", "tpid" : "TPID343454645455" } ] }, { "ordernum" : "ORAAA000000367567345", "buyer" : "Melanie Daniels" "parcels" : [ { "upid" : "UPID456547347776", "tpid" : "TPID645896579688" }, { "upid" : "UPID768577673366", "tpid" : "TPID784574333345" } ] } ] } I need to do a

Problems parsing a JSON response using AngularJS

允我心安 提交于 2019-11-29 07:30:20
I am new using AngularJS and I am having an issue parsing a json response. This is the HTML code I am using: <!DOCTYPE html> <html ng-app> <head> <script src="@routes.Assets.at("javascripts/angular.min.js")" type="text/javascript"</script> <script src="@routes.Assets.at("javascripts/carLibrary.js")" type="text/javascript"></script> </head> <body> <div ng-controller="CarCtrl"> <ul> <li ng-repeat="car in cars"> {{car.name}} <p>{{car.speed}}</p> </li> </ul> <hr> <p>{{response}}</p> </div> </body> </html> And this is the Javascript code using AngularJS: function CarCtrl($scope, $http) { $scope

AngularJS event for when model binding or ng-repeat is complete?

China☆狼群 提交于 2019-11-29 06:44:17
We have a large model and it takes a couple seconds for ng-repeat to bind all the items in the model to the form. We would like to show a spinner while it this is happening. Is there some event that fires when binding is complete so we know when to hide the spinner? Plunkr: http://plnkr.co/edit/GzzTW4?p=preview Use ng-show on the spinner If you are using 1.2 use ng-if <div ng-controller="Ctrl"> <div ng-show="complete">Complete={{complete}}</div> <div class="thing" ng-repeat="thing in things" my-post-repeat-directive> thing {{thing}} </div> </div> In your directive use $last to determine if

Challenge repeating tr with ng-repeat

陌路散爱 提交于 2019-11-29 06:40:33
问题 I'm struggling with a special use case. I provide you with a jsfiddle snippet at the bottom. 1. The HTML table My HTML is a table. ng-repeat directive must be applied to an html element. In my use case, this cannot be done as an instance of ng-repeat is composed of a double tr element: <!-- ng-repeat the following block n times --> <tr> <td>text</td> </tr> <tr> <td tooltip="comment that is bound to the first tr">hover me</td> </tr> AngularJS doesn't provide a syntactic ng-repeat comment

nested table using ng-repeat

北城余情 提交于 2019-11-29 06:33:36
What I'm trying to do is repeat three levels. Demo: http://plnkr.co/edit/qXLcPHXDlOKZYI5jnCIp?p=preview <table> <thead> <tr> <td>Block</td> <td>Column</td> <td>Unit</td> <td>Action</td> </tr> </thead> <tbody ng-repeat="block in building.ownBlock"> <tr ng-repeat="column in block.ownColumn"> <td>{{block.name}}</td> <td>{{column.number}}</td> <td>{{unit.name}} - ? empty</td> <td><button ng-click="edit(unit)">Edit</button></td> </tr> </tbody> </table> but I have failed to do so. Collection $scope.building = { id: 1, name: 'first', ownBlock: [ { id: 1, name: 'Block 1', ownColumn: [ { id: 1, number:

Integration of Angular and JQuery.iCheck by using a directive is not working

拟墨画扇 提交于 2019-11-29 06:25:27
问题 I'm trying to integrate JQuery.iCheck (plugin for checkbox&Radio buttons styling). I followed few suggestions here that said that the way to integrate a jQuery plugins to be fully compatible with Angular ngRepeat is by using directives . So I implemented a directive : webApp.directive('icheck', function($timeout, $parse) { return { link: function($scope, element, $attrs) { return $timeout(function() { var ngModelGetter, value; ngModelGetter = $parse($attrs['ngModel']); value = $parse($attrs[