angularjs-ng-repeat

Adding new row of fields with AngularJS ng-repeat

放肆的年华 提交于 2019-12-11 22:12:27
问题 I am trying to add a new row of fields after the first row when you click the "Add New Participant" button. I've looked at a few sources and followed suggestions but first of all with this ng-repeat in the code, my fields do not show up. And when I click the "Add New Participant" nothing happens. Not sure what I've got wrong here. HTML: <table class="col-md-12" id="client-table"> <tr> <td></td> <td>Given Name*</td> <td>Middle Name</td> <td>Last Name*</td> <td>Date of Birth*</td> <td

AngularJS - Dropdown Select Values are not in Order with ng-repeat

半世苍凉 提交于 2019-12-11 20:31:10
问题 I have a select drop down with the following data; (This is also the output to the console in Chrome). { 8: "Something", 9: "Something Again!", 10: "And again", 11: "And again!", 12: "etc...", 13: "etc etc...", } The html and angular for the select drop down; <select name="name" ng-model="choosen"> <option value="">Please Select</select> <option ng-repeat="(key, value) in data" value="[[key]]">[[value]]</option> </select> The data is got from using the following query within Laravel (4.2)

Using a object on NG-repeat as a filter

爱⌒轻易说出口 提交于 2019-12-11 20:11:22
问题 I have a multiple select dropdowns which are generated from a JSON file of categories. I want to use the choice the users make in the selection to filter a list of apps that are generated with an ng-repeat. I have this plunker http://plnkr.co/edit/ipfVfH3pbLoYk1u4n3la?p=preview which shows the dropdowns generated but the users choice goes into an object and from what i am told you can not use this as a filter for ng-repeat's. Is it possible to use this to filter by or can i convert this? This

Angular js Custom Directive on element with ng-repeat - Can't set CSS classes

本秂侑毒 提交于 2019-12-11 19:37:06
问题 I'm trying to use a custom directive on an element with ng-repeat, like so: <article ng-repeat="product in ctrl.products" class="product entity" product="product" selected-retailer="ctrl.selectedRetailer"></article> I've read that, in order for this to work, you need to set the priority on your custom directive to something higher than the ng-repeat directive. So I've defined my directive like so, setting the priority to 1001: angular.module('MainApp') .directive('product', function () {

AngularJS input with focus kills ng-repeat filter of list

有些话、适合烂在心里 提交于 2019-12-11 19:19:59
问题 Obviously this is caused by me being new to AngularJS, but I don't know what is the problem. Basically, I have a list of items and an input control for filtering the list that is located in a pop out side drawer. That works perfectly until I added a directive to set focus to that input control when it becomes visible. Then the focus works, but the filter stops working. No errors. Removing focus="{{open}}" from the markup makes the filter work. The focus method was taken from this

How to use select inside ng-repeat and keep value selected on api call data

一笑奈何 提交于 2019-12-11 17:27:54
问题 I am using select inside ng-repeat. I am trying to map value coming from my api to select as selected value. I don't know what's wrong going from my side, please correct me. Here is JSfiddle HTML code <div ng-repeat="trip in trips"> {{trip.type}} <select ng-change="typeChanged(selectedType,trip.id)" id="" name="" ng-model="selectedType"> <option ng-selected="trip.type === t" ng-repeat="t in tripTypes">{{t}}</option> </select> </div> JS code $scope.trips=[]; $scope.trips=[{id:1,type:'confirmed

AngularJS: SetValidity in ng-repeat fields

混江龙づ霸主 提交于 2019-12-11 17:15:36
问题 I have a form that generates some fields using ng-repeat. I want to attach each independent field to set validity in case it is left empty. Is there a way to do this? Thanks! 回答1: You need to use ng-form with your ng-repeat . I'd update your example, but you didn't give me one... so the idea is something like this: <form name="myForm"> <div ng-repeat="item in items" ng-form="repeatForm"> <input type="text" name="foo" ng-model="item.foo" required/> <span ng-show="repeatForm.foo.$error.required

Angularjs: summarizing data in one loop with ng-repeat

醉酒当歌 提交于 2019-12-11 17:11:48
问题 I'm trying to rationalize ng-repeat to display and summarize data in one loop. Note: DON'T bring solutions which require looping through the data more then one time. Here is my Ctrl $scope.summary = { keren: 0 , r: 0 , sum: 0 , extra: 0 } $scope.gainSummary = function(obj) { var k = $scope.summary; console.log(obj) if (typeof obj == 'object') { k.keren += obj.keren; k.r += obj.r k.sum += obj.sum k.extra += obj.extra } else { return k; } } $scope.board = [ { date: '10/11/2015' , keren: '1026

ng-repeat with filter for HTML table

巧了我就是萌 提交于 2019-12-11 16:47:14
问题 I am using Angular doing a minimal search function where I used filter and ng-repeat to print a table on HTML page. I am trying to write a custom filter that helps me implement filter data by keywords input. <div> <label>Filter</label> <input ng-model="filterText" type="text" placeholder="Keywords"><br> <p><b>Filter by: </b>{{filterText}}</p> </div> <div> <tr ng-repeat="x in data | myFilter: filterText"> <td>{{x.Key.Food}}</td> <td>{{x.Key.Color}}</td> </tr> </div> And I have a script code

How to populate list of checkbox values with AngularJS?

折月煮酒 提交于 2019-12-11 16:19:20
问题 I am trying to build a quiz application in angular js with serverside for that i have 2 type of choices: Multiple options for one question (input-checkbox) . "dataType": 3, Single option for one question. (input-radio) "dataType": 2, I am trying to populate stored answer for multiple checkbox questions in this case storedAnswer is an array, whereas storedAnswer is an integer value for input radio Note: storedAnswer array contains the option.questionChoiceValue 's My question is how can i