angularjs-ng-repeat

how can refresh my scope after ajax call

回眸只為那壹抹淺笑 提交于 2020-01-17 03:55:08
问题 I am newbie for angularjs.I have list of persons and each person have edit and delete button. when i click to edit button ng-dialog box was open and show person details and person can change and save information on database,behind save button ajax call trigger and update information on database. Updating information on database work well but on UI side my view doesn't reflect my database changes. I had tried to apply "$scope.$apply();" method but i got error message "$digest already in

AngularJS: ng-repeat with ng-include on a multidimensional array

↘锁芯ラ 提交于 2020-01-16 07:06:08
问题 I've started AngularJS yesterday and I need help on a large abstraction. So, I have a multidimensional array in my Controller.js: var appname = angular.module('appname'); appname.controller('articleCollectionController', ['$scope', '$sce', function ($scope, $sce) { $scope.news = [{ title: 'foobar breakthrough', text: 'foobar foobar', image: '<img class="img-responsive img-hover" src="images/foo.jpg">', date: 'June 17, 2014', author: 'John Smith', articleType: 'link', neverSettle: 'engaging',

AngularJS: ng-repeat not displaying JSON

馋奶兔 提交于 2020-01-15 11:34:15
问题 I'm trying to get Angular to display JSON data that I've managed to pull from a database via PDO. The PDO part and JSON encode part is working fine -- console is returning the data as expected. However, when using ng-repeat the div s do display but post.time does not show. HTML <html ng-app="dataVis"> . . . <body ng-controller="GraphController as graph"> <div ng-repeat="post in graph.posts track by $index"> {{post.time}} </div> </body> </html> JSON data [ { "time": "1340", "postId": "282301",

AngularJS: ng-repeat not displaying JSON

自闭症网瘾萝莉.ら 提交于 2020-01-15 11:31:31
问题 I'm trying to get Angular to display JSON data that I've managed to pull from a database via PDO. The PDO part and JSON encode part is working fine -- console is returning the data as expected. However, when using ng-repeat the div s do display but post.time does not show. HTML <html ng-app="dataVis"> . . . <body ng-controller="GraphController as graph"> <div ng-repeat="post in graph.posts track by $index"> {{post.time}} </div> </body> </html> JSON data [ { "time": "1340", "postId": "282301",

AngularJS ngRepeat orderBy in Chrome

江枫思渺然 提交于 2020-01-14 04:23:18
问题 I have a simple app that shows rows of data in Angular. When the controller is initially loaded with data, I want the rows to appear in the same order they were added to my rows array. So, the orderBy property will initially be set to an empty string. Clicking on the column header should then set the orderBy property to the appropriate value. Here's my fiddle: http://jsfiddle.net/fLjMR/3/. Here's my JS: function ctrl($scope) { var rows = []; for(var i = 10;i < 30;i++) { rows.push({name: "Fake

Select multiple objects and save to ng-model

一笑奈何 提交于 2020-01-13 20:31:05
问题 HTML: <select ng-model="contact.groups" ng-options="item.id as item.name for item in groups" ng-multiple="true" multiple> <option value="">Choose groups</option> </select> contact.groups contains a list of groups assigned to the contact: [ { id: 145, name: 'FooBar } ] groups is a list of all available groups. First problem is that item.id in ng-options displays not the correct ID of the group but seems to count from 0 (first group in list), 1 (second group in list), etc Second problem is that

AngularJS set initial active class

*爱你&永不变心* 提交于 2020-01-12 05:35:12
问题 I'm using Bootstrap tabs with an Angular ng-repeat. The problem I'm running into is that the first li and the first div.tab-pane each need an active class. Bootstrap takes care of that after a tab is clicked but, as you can see, not on load. My question is, how can I set an active class on the first li and div.tab-pane ? Demo: http://jsfiddle.net/FQgHx/ 回答1: All you have to do is put an ng-class directive on the tab and tab pane that you would like active initially. You can change the

How to get the index of an parent scope array/ng-repeat inside child ng-repeat

人盡茶涼 提交于 2020-01-11 14:26:09
问题 I am building a table and I have two ng-repeat for my table. My question is if it's possible the child of the ng-repeat can get the parent ng-repeat 's index. For example: <tbody> <tr ng-repeat="company in companies"> <td ng-repeat="product in company"> company # = {{the company index}} and product {{$index}} </td> </tr> </tbody> I am not sure how to add the company index under the td ng-repeat . Is there a way to do this? Thanks a lot! 回答1: This is exactly where ng-init comes into picture,

Angular: Service to Pass Data To Another Controlelr

寵の児 提交于 2020-01-07 03:01:12
问题 So, I have a ng-repeated list of items as such. <li><a ng-click="{{person.id}}">Name of Person</a></li> I would like to create a service wherein, on click, I can collect that person.id and pass it to another controller in a different route. This would normally be very simple by just using the url and route params, however, in this case it is important that the person.id not be exposed within the browser url. -- More Context Whether service or not, I am needing to extract a {{person.Id}} that

Angular-ui-bootstrap — unable to disable tabs inside ng-repeat

浪子不回头ぞ 提交于 2020-01-06 19:52:13
问题 all. I am using angular and ui-bootstrap to create a menu of tabs on which (hopefully) a user can enable/disable tabs that they do not need. I have tried to adhere pretty closely to the template code, as well as implementing my own functions to disable the tabs on click, but I haven't been able to get my tabs to respond the same way that they do in the example. I have been reading around and would guess that it has something to do with the ng-repeat creating its own scope, but I haven't