angularjs-ng-repeat

Difficulty with ng-model, ng-repeat, and inputs

若如初见. 提交于 2019-11-26 00:09:15
I am trying to allow the user to edit a list of items by using ngRepeat and ngModel . ( See this fiddle .) However, both approaches I've tried lead to bizarre behavior: one doesn't update the model, and the other blurs the form on each keydown. Am I doing something wrong here? Is this not a supported use case? Here is the code from the fiddle, copied for convenience: <html ng-app> <head> <link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/css/bootstrap-combined.min.css" rel="stylesheet"> </head> <body ng-init="names = ['Sam', 'Harry', 'Sally']"> <h1>Fun with Fields and ngModel</h1>

How to iterate over the keys and values with ng-repeat in AngularJS?

扶醉桌前 提交于 2019-11-25 23:59:25
问题 In my controller, I have data like: $scope.object = data Now this data is the dictionary with keys and values from json . I can access the attribute with object.name in the template. Is there any way that I can iterate over the keys as well and display them in table like <tr><td> {{key}} </td> <td> data.key </td> The data is like this { \"id\": 2, \"project\": \"wewe2012\", \"date\": \"2013-02-26\", \"description\": \"ewew\", \"eet_no\": \"ewew\", } 回答1: How about: <table> <tr ng-repeat="(key

How to make ng-repeat filter out duplicate results

烂漫一生 提交于 2019-11-25 23:09:50
问题 I\'m running a simple ng-repeat over a JSON file and want to get category names. There are about 100 objects, each belonging to a category - but there are only about 6 categories. My current code is this: <select ng-model=\"orderProp\" > <option ng-repeat=\"place in places\" value=\"{{place.category}}\">{{place.category}}</option> </select> The output is 100 different options, mostly duplicates. How do I use Angular to check whether a {{place.category}} already exists, and not create an

ng-repeat finish event

杀马特。学长 韩版系。学妹 提交于 2019-11-25 22:05:42
问题 I want to call some jQuery function targeting div with table. That table is populated with ng-repeat . When I call it on $(document).ready() I have no result. Also $scope.$on(\'$viewContentLoaded\', myFunc); doesn\'t help. Is there any way to execute function right after ng-repeat population completes? I\'ve read an advice about using custom directive , but I have no clue how to use it with ng-repeat and my div... 回答1: Indeed, you should use directives, and there is no event tied to the end