I can't see the attachment. [email protected]
2014-06-28 14:29 GMT-03:00 sravya srungarapu <[email protected]>: > Hi thank you for the response. i have already tried that..but it did not > work. > > > On Saturday, June 28, 2014 1:10:36 AM UTC+5:30, Rishi Tandon wrote: > >> You might want to use $apply method >> >> On Friday, June 27, 2014, sravya srungarapu <[email protected]> >> wrote: >> >>> Hi, >>> >>> I created a simple datatable using angular js. When I run this code, the >>> datatable shows up properly. I wrote ng-click to delete the particular row >>> from datatable. When i test the code below and click on any of the >>> lastnames the element is getting removed from array persons but not from >>> datatable. Am I doing anything wrong here? Please help. I have attached >>> complete code(example.html). >>> >>> *My HMTL Code*: >>> <div ng-controller="simpleCtrl"> >>> <table datatable="ng"> >>> <thead> >>> <tr> >>> <th>ID</th> >>> <th>FirstName</th> >>> <th>LastName</th> >>> </tr> >>> </thead> >>> <tbody> >>> <tr dt-rows ng-repeat="person in persons"> >>> <td>{{ person.id }}</td> >>> <td>{{ person.firstName }}</td> >>> <td><a ng-click='remove(person)'>{{ person.lastName }}</a></td> >>> </tr> >>> </tbody> >>> </table> >>> </div> >>> >>> *Controller code:* >>> controller('simpleCtrl', function($scope, $http) { >>> $scope.persons = []; >>> $http.get('data.json').success(function(persons) { >>> $scope.persons = persons; >>> }); >>> >>> $scope.remove = function(item){ >>> var index = $scope.persons.indexOf(item); >>> console.log(index); >>> $scope.persons.splice(index,1); >>> console.log($scope.persons); >>> } >>> }); >>> >>> Thanks, >>> Sravya >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "AngularJS" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To post to this group, send email to [email protected]. >>> Visit this group at http://groups.google.com/group/angular. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> -- >> *Rishi Tandon* >> Pearson Learning Technology Group >> >> Mobile: (310) 926-9032 >> >> Pearson >> Always Learning >> Learn more at www.pearson.com >> >> -- > You received this message because you are subscribed to the Google Groups > "AngularJS" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/angular. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
