ng-repeat

How to get list of values which are selected in radio button after click on submit in Angular js

时间秒杀一切 提交于 2019-12-01 13:00:43
Here is the HTML, this file is partial where global controller is defined in home page:message object contains data which is loaded from first page . <ng-repeat data in message> <input type="radio" ng-model="accountValue" value="{{data}}" name="select" /> {{data.Type}} {{data.Number}} Continue JS: myApp.controller('myCtrl',['$scope',function ($scope) { $scope.selectAccount = function(id) { alert(id); } }]); I am getting id as undefined . Please help. thanks So as per the comments what you exactly need is to share the data between two controllers (i.e Global and myCtrl ) on onclick of continue

Based on country selected , need to populate state and city

廉价感情. 提交于 2019-12-01 10:37:57
问题 HTML: <label for="country">Country *</label> <select id="country" ng-model="statessource" ng-options="country for (country, states) in countries" ng-change="GetSelectedCountry()"> <option value=''>Select</option> </select> <label for="state">State *</label> <select id="state" ng-disabled="!statessource" ng-model="model.state" ng-options="state for (state,city) in statessource" ng-change="GetSelectedState()"><option value=''>Select</option> </select> <label for="city">City *</label> <select id

ng-repeat

删除回忆录丶 提交于 2019-12-01 10:14:41
ng-repeat 指令用于循环输出指定次数的 HTML 元素。集合必须是数组或对象。 我在项目中所做的需求是:输入检索条件,点击查询按钮,调接口,将查询结果展示在页面上,结果可能是一条或者是多条;点击展示结果列表中的某一条,获取该数据信息, 遇到的问题:列表数据很多条,又是循环展示的,无法确认点击的是哪一条数据,获取不到想要的该条数据信息。 解决方法:HTML部分---> <div ng-repeat=" item in salesmanList " ng-click="getToken($index)"></div> JS部分 -----> $scope.salesmanList = [ ]; $scope.getToken = function (index) { var obj= { salesman:{ empId: $scope.salesmanList[index].empId } } .................................................. } 来源: https://www.cnblogs.com/linm/p/11679687.html

How to update ng-model dynamically in ng-repeat?

断了今生、忘了曾经 提交于 2019-12-01 09:04:45
I am facing some problem with dynamic ng-model values in my angular page. Here is my sample JSON. mytabs = [ { name : "tab1", values : [ {value:"value1"}, {value:"value2"}, {value:"value3"}, {value:"value4"} ] }, { name : "tab2", values : [ {value:"value1"}, {value:"value2"}, {value:"value3"}, {value:"value4"} ] } ] What I want to do from this josn is, creating a view in my page such that, It will contain tab1 and tab2 as headings of page and the respective value as a checkbox . The user will have the selectivity to select his option. On submit I want to get the options he selected. I want to

ng-repeat animation not working

落爺英雄遲暮 提交于 2019-12-01 08:38:34
My animation with ng-repeat does not seem to work . Here is the plunkr http://plnkr.co/edit/kYtzM9d0rzGmrniybz9c?p=preview Any inputs. 1. You have registered two modules: <html ng-app="plunker"> And: <body ng-app="testApp"> Remove ng-app from the html tag. 2. You need to load angular-animate.js 3. As you are moving the elements within the array, it's neither enter or leave you should use, but instead move : .ng-move { 4. You are using the ng-animate directive ( ng-animate="'animate'" ) which is deprecated since 1.2. You are also passing it a class that does not exist. This would work: .ng-move

ng-repeat animation not working

纵然是瞬间 提交于 2019-12-01 05:59:01
问题 My animation with ng-repeat does not seem to work . Here is the plunkr http://plnkr.co/edit/kYtzM9d0rzGmrniybz9c?p=preview Any inputs. 回答1: 1. You have registered two modules: <html ng-app="plunker"> And: <body ng-app="testApp"> Remove ng-app from the html tag. 2. You need to load angular-animate.js 3. As you are moving the elements within the array, it's neither enter or leave you should use, but instead move : .ng-move { 4. You are using the ng-animate directive ( ng-animate="'animate'" )

Angularjs - add additional row inside a tr ng-repeat

≡放荡痞女 提交于 2019-12-01 05:44:05
Ng-repeat is present on a table row My query is how can we achieve the following: <tr ng-repeat="x in y"> Looping here.... </tr> Now as data object is looping on a <tr> . I have a scenario where I have to display data of 1 row in two <tr> . Eg. Table Data1 data1.2 data1.3 data1.4 Data2 data2.2 Data2b data2.3 data2.4 Data3 data3.2 data3.3 data3.4 Data4 data4.2 data4.3 I.e. display data of 1 row in two Can't use ng-repeat-end 1) You can combine ng-if with ng-repeat and 2) ng-repeat supports multi-element with ng-repeat-start and ng-repeat-end : <tr ng-repeat-start="item in [1, 2, 3, 4, 5, 6]">

AngularJS, ngRepeat, and default checked radio button

大兔子大兔子 提交于 2019-12-01 04:20:51
When using ngRepeat, 3 pairs of radio buttons can be created using the following code: <div ng-repeat="i in [1,2,3]"> <input type="radio" name="radio{{i}}" id="radioA{{i}}" value="A" checked> A <input type="radio" name="radio{{i}}" id="radioB{{i}}" value="B"> B </div> For some reason, only the last pair of radio buttons generated by ngRepeat is affected by the checked attribute. Is this because of the way AngularJS updates the view? Is there a way to fix it? That is possibly because when browser renders the radio buttons (as ng-repeat expands) all your radios have same name i.e "name="radio{{i

ng-repeat on two arrays

谁都会走 提交于 2019-12-01 03:25:53
I want to do a ng-repeat on an array which is composed of two arrays, like this : [titles: [], links: []] My arrays (titles and links) have the same length What i want to print in my ng-repeat, finally, is anything like that : {{ array.title }} {{ array.link }} For example, in a C program i have to do that : int i; i = 0; while (titles[i]) { printf("%s - %s", titles[i], links[i]); i++; } It's not clear how you have your data — [titles: [], links: []] isn't meaningful. Ideally you would arrange your data as an array of objects that looks like: var array = [{title: "foo", link: "bar"}, {title

Angularjs - add additional row inside a tr ng-repeat

烂漫一生 提交于 2019-12-01 02:54:28
问题 Ng-repeat is present on a table row My query is how can we achieve the following: <tr ng-repeat="x in y"> Looping here.... </tr> Now as data object is looping on a <tr> . I have a scenario where I have to display data of 1 row in two <tr> . Eg. Table Data1 data1.2 data1.3 data1.4 Data2 data2.2 Data2b data2.3 data2.4 Data3 data3.2 data3.3 data3.4 Data4 data4.2 data4.3 I.e. display data of 1 row in two Can't use ng-repeat-end 回答1: 1) You can combine ng-if with ng-repeat and 2) ng-repeat