angularjs-ng-repeat

AngularJS: ngMessages not working with ng-options in select

谁都会走 提交于 2019-12-11 15:54:35
问题 I have seen few answers which were working for ng-repeat, but with ng-options I am facing issue. Problem : Want to show the error message required if the dropdown is touched and nothing is selected, I am able to do this with input fields. JS CODE $scope.personMap = [{ name:"Abc", id:"a"}, { name:"XYZ", id:"b"}, { name:"FGH", id:"c"}, { name:"TY", id:"d"} }] HTML <select name="inpName" ng-model="person.name" ng-options="i as i.name for i in personMap track by i.id" required> <option value=""

AngularJS : Custom directive scope not being initialized properly when used with ng-repeat

懵懂的女人 提交于 2019-12-11 14:54:02
问题 I have a problem with passing object information to my custom directive, which has an isolate scope. I have boiled my problem down to this simple plnkr to demonstrate the wall I am hitting: http://plnkr.co/edit/oqRa5pU9kqvOLrMWQx1u Am I just using ng-repeat and directives incorrectly? Again, my goal is to pass the object information from the ng-repeat loop into my directive which will have its own scope. HTML <body ng-controller="MainCtrl"> <ul> <li ng-repeat="i in items", my-directive="i">

why alert is not display in angularjs

天涯浪子 提交于 2019-12-11 13:51:53
问题 I am trying to use require js in angular js project .I am able to show view but issue is that I am not able to get alert on "Login" button click .Actually I show One alert on button click . Here is my code http://plnkr.co/edit/jv79297BZLiJpY66rKAc?p=preview function ctrl($scope, $state) { $scope.login = function () { alert("Login is clicked") }; } I think I got error on console that why I am not able to display alert ? http://errors.angularjs.org/1.2.12/ng/areq?p0=LoginCtrl&p1=not%20a

How to use index of each item when item is written in directive?

泪湿孤枕 提交于 2019-12-11 13:44:39
问题 I just want to point out that this is my first attempt to create simple app in AngularJS .I have a table , and in each row I'm displaying task which contains Index,Name,Activity,Time properties and also edit and delete buttons.Everything is working perfect. <table class="table table-striped " style="width: 100%"> <tr ng-repeat="task in tasks" > <td>{{$index}}</td> <td>{{task.name}}</td> <td>{{task.activity}}</td> <td>{{task.time}}</td> <td ><button type="button" ng-click="editRow($index)"

AngularJS multiple radio options

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 13:28:37
问题 Good afternoon, We are currently trying to learn AngularJS and although we're picking up some pretty cool codes we can't seem to figure this issue out. We are wanting to display a list of product options relative to the selected product within the dropdown feature from here we want to be able to tick one radio button on each row but at the moment when we tick one of the radio buttons it seems to be selecting all within each of the columns. We've attached our code snippets and screenshots, if

Nested Dropdown- ng-options inside ng-repeat in angularjs

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 13:27:50
问题 I wants to catch parent name and id on child selection. Output should be: $scope.selected = [{"name": "Request1", "id":1, "status":[{"name":"status1","isSelected":true}, {"name":"status2","isSelected":false}] }] Able to get selected child but respective parent not getting. // Code goes here var app = angular.module('demo', []); app.controller('myController', function($scope){ $scope.requests=[{"name": "Request1", "id":1}, {"name": "Request2", "id":2},{"name": "Request3", "id":3} ]; $scope

Double loop to get Ng-options

痴心易碎 提交于 2019-12-11 13:23:44
问题 I want to get all the tasks name as task id, where array of tasks are stored in array of groups. I am trying to get it in ng-options directive of angularJS. Here is http://jsfiddle.net/753YB/16/ link for quick edit. thanks in advance! I know in single array it is task.Id as task.Name for task in Tasks but my tasks are nested in groups so I need tasks in all group. $scope.Groups = [{ Name: 'a1', Id: 1, Tasks:[{Name: 'Some Name' Id: 1},{Name: 'Some Name 2' Id: 2}] }, { Name: 'c2', Id: 2, Tasks:

Compare dates in ng-repeat

依然范特西╮ 提交于 2019-12-11 13:15:59
问题 Here is my problem, i would like to compare 2 dates and display every date for which my ng-if is true. But this don't work because when only one of my user.created_at is inferior to time my ng-if return false and nothing is display. <ul ng-repeat="user in userticket track by $index" ng-if="user.created_at > time" > <li class="row ticketlist">{{user.created_at | amDateFormat:'YYYY.MM.DD'}}</li> </ul> and in my controller: $scope.time = "2015-06"; 回答1: Use Date objects for all the times. Then

Angularjs 1.2: include template in repeat

Deadly 提交于 2019-12-11 13:12:12
问题 I am moving to the last version of angularjs (1.2), and now it seems that i cant include templates in the repeater: http://plnkr.co/edit/K7n9sNhXe4z99VMSqTlk?p=preview I can use directive with templateUrl but is there a way to do this with ng-include only ? Thanks. Note : this works with the latest stable angularjs version (1.0.7) EDIT : Error log (latest Chrome version) on each repeat element: TypeError: Cannot call method 'insertBefore' of null at https://ajax.googleapis.com/ajax/libs

Incorrect radio button getting selected for ng-repeat radio buttons

[亡魂溺海] 提交于 2019-12-11 12:39:31
问题 I have a list of radio buttons using ng-repeat. When I initially load the page and select on the last radio button, the button on it's side gets selected. This only happens for the first time, i.e. if I click on the last button a second time, it is selected correctly. <input type="radio" name="rb" value="{{rbCollection.name}}" data-ng-click="open(name)" data-ng-model="Ctrl.selection"> 回答1: Check this so. The problem is that ng-click fires before the ng-model code that updates the scope. If