Your scope functions are inside of your http.get success. You should put those functions out of this promise.
Em quinta-feira, 15 de maio de 2014 08h45min59s UTC-3, Mathias Christensen escreveu:
Hello everyone! I'm using Couchdb to store my data. and createNewCustomer + the list of customers works fine. I need help to delete.This is my ng-click:
---->> <td><a ng-click="remove(customers.id)" class="btn btn-small btn-danger" style="width:100px;">Delete {{customers.doc.company}}</a></td>I've tried a lot of stuff inside my controller, and this is what I got so far. This is both the listing and now I want to add the delete function inside same ctrl.:
var customerListApp = angular.module('customerListApp', []);customerListApp.controller('customerListCtrl', ['$scope', '$http',function (scope, http) {scope.customerList = data.rows;scope.sortField = 'company';scope.reverse = true;
});
---------------vvvvvvvvvvvvvvvvvvv---------------------------scope.remove = function (id) {for (i in customers) {if (customers[i].id == id) {customers.splice(i, 1);}}}}]);
I've done that, but still not working. I do have in mind, that maybe I should store my data before it can get it by id or something? I'm quite new to angularjs :/
--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/CGfo4fBKm4k/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.