ng-repeat

Angularjs disabling drop down

一笑奈何 提交于 2019-12-23 01:40:06
问题 I have a ui in which based on the selection of one drop down another dropdown should be disabled. Both these dropdowns are generated using ng-repeat . Below is the code sample <tr data-ng-repeat="abc in xyz.divisionViewList" > <select data-ng-model="abc.selectedAppRole" ng-init="abc.selectedAppRole =abc.selectedAdRole" id="{{abc.applicationId}}_{{abc.divisionId}}" name="{{abc.selectedAppRole}}"> <option value="null">Select/Deselect a role</option> <option data-ng-repeat="roleDetail in abc

Angularjs - animating children of repeated elements

╄→尐↘猪︶ㄣ 提交于 2019-12-22 04:01:40
问题 Friends, I'm banging my head about this issue, I was hoping you can help me. I'm trying to animate the child of a repeated element with angularjs 1.2rc1 (perhaps this has changed?), more or less like this: <div ng-repeat="row in rows" class="animated-row> <div class="animated-child">Row content</div> </div> What I want is to animate the child to move inside the repeated row on enter and leave. Therefore, I have tried, as per the documentation, a selector like this: .animated-row { overflow:

id as ng-model for select in angularjs

好久不见. 提交于 2019-12-22 03:51:01
问题 I am not getting the id value of the option value of selected item of tag. <div ng-controller="UserCreationCtrl"> <form novalidate="novalidate" class="form-horizontal"> <div class="control-group"> <label class="control-label" for="inputFirstName">First name:</label> <div class="controls"> <input type="text" id="inputFirstName" ng-model="doctor.firstName" placeholder="First name"/> </div> </div> <div> <span class="nullable"> <select ng-model="user.lookupId" ng-options="select as speciality

Changing value of a boolean using ng-click used inside a ng-repeat

喜夏-厌秋 提交于 2019-12-21 20:25:30
问题 I am displaying some data on my html page inside a div using ng-repeat. Inside the div I have a button in order to hide the content of each div seperately.Here is a simplified version of my html file. <body ng-app="task" ng-controller="repeat"> <div ng-repeat='x in array' ng-show="{{ x.show }}"> <p>{{ x.text }} </p> <button ng-click="toggle()">Hide</button> </div> </body> the code in my .js file is as follows var app = angular.module('task'); app.controller('repeat',function($scope){ $scope

How to Parse JSON response into ng-repeat correctly in Angularjs

独自空忆成欢 提交于 2019-12-21 05:24:15
问题 I want to be able to use ng-repeat in order to parse my response on the front end. I am having trouble parsing responses that have multiple items versus a single item using ng-repeat list. I am able to parse; but I have to create 2 different list with separate ng-repeat configuration on the front end and add some ugly logic to not display if length of array is greater than one. My goal is to have only one ng-repeat element in my partial and it handles both responses or a better approach to

Ng-Repeat array to rows and columns

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-20 10:32:57
问题 Thanks for taking the time to read this, I was wondering how I might be able to use ng-repeat to create a grid like box of options. I would like to take an array repeat nth number of items and then move to the next row or column until all items are listed. e.g. assuming I had an array like [opt1,opt2,opt3,opt4,opt5,opt6,opt7] I would like to display it like this: opt1 opt2 opt3 opt4 opt5 opt6 opt7 回答1: This is more a styling/markup problem than an AngularJS one. If you really want to, you can

ng-repeat runs twice (Angular) [duplicate]

笑着哭i 提交于 2019-12-20 06:31:11
问题 This question already has answers here : Why is ng-style function applied twice? (2 answers) Closed 5 years ago . Consider the following ng-repeat: <p ng-repeat="item in items"> <span ng-bind="getName(item)"></span> </p> Now the weird thing is that if I have an array with 10 items, the getName is called 20 times Checkout this jsfiddle Can someone explain why this is happening. Performance wise this might be a killing (I can imagine) 回答1: This is standard behavior for angular. Angular runs

Angular ng-style for ::after

不问归期 提交于 2019-12-20 04:12:47
问题 I am designing a dynamic hr (horizonatal) rule. In my Style sheet hr.my-hr:after{ content:'Generic' } In my template <div ng-repeat="name in ['Adam', 'Collin', 'David']"> <hr class="my-hr" ng-style="{'content':name}"> But how do i dynamically change the content in the template when using ng-repeat ???? 回答1: All ng-style does is add inline styles. However you want to add a psuedo element ::after . According to the MDN: You can use only one pseudo-element in a selector. It must appear after the

ng-repeat not updating the list when adding data

孤人 提交于 2019-12-20 03:19:55
问题 my problem is that the ng-repeat is not updating automatically the data. When I press add pin in my code, the element is added correctly to the database. If I reload the page the data appear correctly, but not as angular should. For the record, the Update and delete are working correctly. Thanks in advance This is my app.js code: var app = angular.module("app", []); app.controller("AppCtrl", function ($http) { var app = this; $http.get("/api/pin").success(function (data) { app.pins = data

How to get selected value from ng-repeat

房东的猫 提交于 2019-12-19 05:08:11
问题 This is my code. I m getting data through ng-repeat and showing it as shown in below code. What I want is if I click on either of the name then it should alert me with that name. How can I achieve this?? var myfriend = angular.module('myfriend',[]); myfriend.controller('myfriendController', function($scope) { $scope.record = [ { "id" : "01", "firstname" : "Mohan ", "middlename" : "K", "lastname" : "Futterkiste1" },{ "id" : "04", "firstname" : "Rohan ", "middlename" : "A", "lastname" :