Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Re : Bind and events understanding

$
0
0
This code from example in docs:
  1.     Recipe = can.Model.extend({
            destroy : "DELETE /collection/{id}",
            findOne : "GET /collection/{id}"
        },{});

        Recipe.bind("destroyed", function(){
            console.log("a recipe destroyed");
        });
       
        Recipe.findOne({id: 105}, function(recipe){
            recipe.bind("destroyed", function(){
                console.log("this recipe destroyed");
            });
            recipe.destroy();
        });

Send only GET query to my RESTful API and both events are fire. But destroy is not work. Console log:

  1. GET http://localhost/collection/105
    this recipe destroyed
    a recipe destroyed

Viewing all articles
Browse latest Browse all 3491

Trending Articles