ng-repeat

Not able to display correct data in table -AngularJS

匆匆过客 提交于 2019-12-24 04:32:05
问题 Below is my plunker where I have tried to display the data under each category.But the data are not printing as supposed to .Example:-rom value 12345 should come directly under bread. I'm not sure where I'm doing wrong in my code: $scope.allProducts = []; angular.forEach($scope.data,function(item, index){ angular.forEach(item.products, function(item2, index){ if($scope.allProducts.indexOf(item2.consummable) == -1){ $scope.allProducts.push(item2.consummable); } }) }) Creating a table matrix

angular-datatables rendering (repeating) twice

淺唱寂寞╮ 提交于 2019-12-24 04:03:22
问题 I am using angular datatables https://l-lin.github.io/angular-datatables and noticed that the ng-repeat is done twice. I noticed it with the following directive. <tr ng-repeat="order in vm.orders track by order.id" repeatlogger> app.directive('repeatlogger', function() { return function (scope, element, attrs) { console.log(scope.$index); } I am using the Angular way, see HTML tab at https://l-lin.github.io/angular-datatables/#/angularWay <table datatable="ng" class="row-border hover"> <thead

Generate ng-model inside ng-repeat

旧城冷巷雨未停 提交于 2019-12-24 02:09:46
问题 I have been reading a few topics but couldnt find a solution to this one I am stuck on. I am trying to add ng-model inside ng-repeat something like this: <span ng-repeat="list in lists"> <input type="checkbox" ng-model="formData.checkboxes.{{ list.value }}"> {{ list.number }} {{ list.description }} <br/> </span> and the list values are like this: $scope.lists = [ { value:'value1', number: '1', description:'Lorem ipsum dolor sit amet, consectetur adipiscing elit. ', }, { value:'value2', number

Validation on fields using index position

时光怂恿深爱的人放手 提交于 2019-12-23 18:41:59
问题 I have a couple of fields that I would like to replicate dynamically. I'm using ng-reapt which is doing the job. However, the validation messages are not working. Here's what I've got: <html ng-app="app"> <head> <title>teste</title> </head> <body ng-controller='testController'> <label>Number of Workers</label> <select ng-model="quantity" ng-change="changed()"> <option value="1" selected="selected">1</option> <option value="2">2</option> <option value="3">3</option> </select> <form name='frm'

AngularJS access to $first of ngRepeat parent in a nested ngRepeat

放肆的年华 提交于 2019-12-23 18:22:50
问题 I'm trying to get access to $first of a ngRepeat parent from within a nested ngRepeat. Is there a way to alias or access $first for use within nested ngRepeat? I've tried $parent.$first, but it doesn't appear to work. Outputting to screen by interpolation indicates it has the same value as the $first of the nested child. $parent.$first // same value as nested child 回答1: Yeesh, you have to go up two-levels to access the ngRepeat parent directive: $parent.$parent.$first 来源: https:/

two way binding not working with ng-repeat

一笑奈何 提交于 2019-12-23 08:07:23
问题 I have a simple ng-repeat list, in which i am assigning current list item value to another property on the controller as follows: <li ng-repeat="num in list"> <input type="text" ng-init="value = num" ng-model="value" /> <button type="button" class="btn btn-primary" ng-click="save()">Save</button> </li> But when i click the Save button i get default value set for $scope.value. I expect the value for the particular input text to be displayed. Here is the controller: angular.module('myApp', [])

How can I pull data (JSON) from a clicked ng-repeat item to load a new, item specific page using $stateParams and ui-router?

烈酒焚心 提交于 2019-12-23 05:16:23
问题 This question is similar to what I am asking and I have already implemented some of the code from that. I'm using UI-Router instead, but my main issue is with the $http request and passing the data from the service to the controller. Basically I want to display the details on the album.html from the album clicked on the previous page. I really just need help with the service and the controller. The HTML is just there for reference/context. Sorry if this is hard to understand. Please comment

angular ng-repeat data binding function performance

一笑奈何 提交于 2019-12-23 05:04:18
问题 I'm looping through lots of data. Each object has a property startTime and duration, which is unique for each object. I need to do calculations on this startTime and duration for each object in the array and set the elements width based off these calculations. <div ng-repeat = "event in events track by event.id"> <div style="width:{{calculateWidth(event.startTime, event.duration)}}%"> <div>more content</div> </div> <div> and my js $scope.calculateWidth = function(duration, starTime){ var

AngularJS Dependent dropdown with ng-repeat

隐身守侯 提交于 2019-12-23 04:58:15
问题 I have two drop down fields where the second one is dependent on the selection in the first. The data for the first drop down comes from one data set. It lists the number associated with an account ng-repeat="option in acctList" . I want to go to a different data set, find the account numbers that match, and then show the Customers that are related to that account. The second drop down should show nothing (blank) when nothing has been selected in the first. Here is my plunker with the two

Using ng-repeat to pull data from 2 different JSON files

。_饼干妹妹 提交于 2019-12-23 04:39:11
问题 I am not getting an errors, but cannot get my data to render. My structure is simple in that json files in one folder, views in another, scripts/controllers in another. Simply using the controller to do the work since it is a straight forward widget. Any ideas on what may be causing this to fail as I am not getting errors and I believe my mapping is correct. My code: updated view here: <div class="col-md-5 propDtl" style="padding: 10px; display: block;" ng-repeat="item in items"> <div class=