Ranu Mandan
Ranu Mandan

Reputation: 286

Sammy.js + ASP.NET MVC overloaded controller method

While trying out some example with Sammy.js and ASP.NET MVC 3 , i have found that Sammy.js does not support overloaded controller method call.

please refer below code :

(function($) {

    var app = $.sammy('#main', function() {

      this.get('#/Home/Posts', function(context) {
        context.log('Retrieve all posts');
      });

      this.get('#/Home/Posts/:id', function(context) {
        context.log('Retrieve post by id');
      });

    });

    $(function() {
      app.run('#/');
    });

})(jQuery);

When I try to use single method in controller (i.e. Without overloading it works fine) but after overloading the method sammy.js script does not respond.

Has anyone got a workaround to deal with this problem ?

Upvotes: 2

Views: 813

Answers (1)

liammclennan
liammclennan

Reputation: 5368

Change the second action to

this.get('#/Home/Post/:id', function(context) {
    context.log('Retrieve post by id');
});

Upvotes: 1

Related Questions