You should check the network log in chrome dev tools to see if it's
properly constructing the URL. My initial question would be: are _id and
_rev defined on the scope where you do the ng-click? It seems like you'd
probably rather be doing ng-click="removeCustomer(customers.doc.id,
customers.doc.rev)" or something similar.

e


On Tue, May 20, 2014 at 3:25 PM, Mathias Christensen <
[email protected]> wrote:

> Hey guys!
>
> I'm pretty stuck at the moment and hope that I could get some help here.
> I'm using coucDB to store data. I want to Delete documents by ID, but seems
> like my code ain't working. I'm really stuck.
>
> This is how I GET my datas, and it works:
>
> http.get('
> http://127.0.0.1:5984/customers/_all_docs?include_docs=true').success(function(data)
>  {
>         scope.customerList = data.rows;
>
> But now I want to be able to delete data by ID. In my html page it looks
> like this:
>
> <td><a ng-click="removeCustomer(_id, _rev)" class="btn btn-small
> btn-danger" style="width:100px;">Delete {{customers.doc.company}}</a></td>
>
> But my controller which looks like this doesn't work:
>
> scope.removeCustomer = function (_id, _rev) {
>             http.delete('http://127.0.0.1:5984/customers/' +_id + '?rev='
> + _rev).then( alert ('Deleted!'));
>         };
>
> It does alert the "Deleted", but it's not. When I fill out the ID+rev
> manually like this: 'http://127.0.0.1:5984/customers/some_id?rev=some_rev'
> it works and delete the document. So something is missing to identify the
> ID + rev. How should I do this?
>
> Thanks for reading.
>
> Regards,
>
> Mathias.
>
> --
> 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.

Reply via email to