angularjs-ng-repeat

How to make dynamically bound AngularJS models within nested ng-repeat not throw an error until the model is supplied data from somewhere else?

廉价感情. 提交于 2019-12-22 09:18:10
问题 The Problem jsFiddle Demonstrating the problem http://jsfiddle.net/7sfaB/ I have a situation I've run into in using AngularJS where I'm building a set of nested <ul> using ng-repeat with a nested ng-repeat from a config service that contains the structure of the lists. Within this nested ng-repeat , I am attempting to use a single complex model object by building the model dynamically based on properties within the config service and binding to an input field. (e.g. ng-model="data[category.id

Filter ng-repeat based on search input

点点圈 提交于 2019-12-22 09:14:33
问题 I have the following html: <div> <div> <input type="text" placeholder="Search" ng-model="userSearch.firstname"> </div> </div> <div> <div ng-repeat="user in users | filter:userSearch "> <div> {{user.firstname}} {{user.lastname}} </div> </div> </div> So I have an input field where the users can type and search in my list of all users. Is there a way I can apply a filter inline in the ng-repeat based on what the user types in the search input? Current solution only filters on firstname I would

Bind event to child element of directive in link function

南笙酒味 提交于 2019-12-22 08:59:30
问题 Need to bind an event to directive's children which is prepared with ng-repeat in templateUrl. I am trying to bind the event in link function but the children are not yet prepared. Here is the plunker. Here I want to bind click event on li tag which are prepared with ng-repeat.But by the time, the link is executed, the li elements are not yet prepared. Can somebody please help. 回答1: I've resolved the same problem with the angular $timeout link: function (scope, element) { $timeout(function ()

Angularjs : sorting shows different result in chrome and firefox browser

折月煮酒 提交于 2019-12-22 08:18:00
问题 HI I am getting different result in chrome and firefox browser of sorting of data. Firefox shows correct one. HTML : <table class="datatable"> <thead> <tr> <th width="5%" class="Rank">Rank <a ng-click="sort_by('Rank')"><i class="icon-sort" ng-show="pagedItems[currentPage].length > 1"></i></a></th> <th width="10%" class="Interviews">Interviews <a ng-click="sort_by('Interviews')"><i class="icon-sort" ng-show="pagedItems[currentPage].length > 1"></i></a></th> <th width="25%" class="Dealership"

how to append items to the same row or line with ng-repeat

旧城冷巷雨未停 提交于 2019-12-22 05:55:25
问题 I'd like to append items to the same row with ng-repeat, but it seems to add the items on a new line. In the following example I'd like them to be on the same row like: "John who is 25 years old. Jessie who is 30 years old. Johanna who is 28 years old." The result is instead: John who is 25 years old. Jessie who is 30 years old. Johanna who is 28 years old. How can I accomplish that? <div ng-init="friends = [ {name:'John', age:25, gender:'boy'}, {name:'Jessie', age:30, gender:'girl'}, {name:

CSS3 Animation with AngularJS not sliding correctly in Firefox

旧街凉风 提交于 2019-12-22 05:06:37
问题 I made a CSS3 animation connected to an ng-repeat which then shows an inline-list with Bootstrap3, I limited the number of maximum 3 of the list showing and I have some little issues with appears mostly in Firefox (believe it or not IE11 is without issues, wow I was surprised). I have 2 buttons (previous/next) and when I click the Next button then the animation of sliding from left to right start to do his job, but in Firefox when clicking multiple times, it seems that the animation only

ng-repeat on object properties but defocuses input box after typing

青春壹個敷衍的年華 提交于 2019-12-22 02:57:17
问题 I am using ng-repeat to bind form elements to the properties of a custom object I have, example: $scope.myObject = { 'font-size': 10, 'text-outline-width': 2, 'border-color': 'black', 'border-width': 3, 'background-color': 'white', 'color': '#fff' } HTML: <div ng-repeat='(key, prop) in myObject'> <p>{{key}} : {{prop}}</p> <input type='text' ng-model='myObject[key]'> </div> However, every time I try to type in a value into the input box, the text box gets deselected and I have to reselect it

ng-repeat not binding when directive template is loaded via templateUrl

时间秒杀一切 提交于 2019-12-22 00:15:52
问题 I've been stuck on this for hours and hours - can anyone help? I have a list of nested directives, which I'm iterating through ng-repeat. The templates for these directives are fairly chunky so I've modularised them into separate HTML files and loaded them via templateUrl, but this seems to be breaking the data binding. I've replicated the problem here: http://plnkr.co/edit/72HUb0vhtpYWuRHnlq3b?p=preview HTML: <div project-ext ng-repeat="project in projects"></div> project.html {{project.name

AngularJs ng-repeat track by $index issue with angular-bootstrap-switch [duplicate]

流过昼夜 提交于 2019-12-21 22:43:49
问题 This question already has an answer here : Problems with `track by $index` with Angular UI Carousel (1 answer) Closed last year . I am having an issue with AngularJs ng-repeat and angular-bootstrap-switch I am using: ng-repeat="item in items track by $index" When I added a new item into the first index of array by: newItem = {}; items.splice(0, 0, newItem); The DOM contain a bs-switch: When a new item added it reuse the first element in array base on $index, so it doesn't re-render (that's

Angular with Microdata

梦想的初衷 提交于 2019-12-21 17:31:44
问题 Does Microdata work with dynamic Angular ng-repeat items? Can I use it as: <div itemscope itemtype="http://schema.org/Product" ng-repeat="item in items"> … </div> 回答1: I have found schema validator which, for my site actually shows angular expressions: ... datePublished {{lvl_project['year']}} name "{{lvl_project['title']}}" keywords {{lvl_project['tools'].join(',')}} ... Furthermore, it does NOT show all of the ng-repeat -generated elements. This seems to me like a strong indication that the