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

Re : How to return a value from Controller methods

$
0
0
Thanks for your reply. Actually I have a widget controller with a "val" method. It works just fine if I do:

$("#myelement").controller().val()  // returns the expected value

But I'd prefer to use:

$("#myelement").special_input("val")  // returns the jquery object for chaining

Where "SpecialInput" is the widget controller and "special_input" is the JMVC-created plugin. Having the controller name is in the code makes it better self-documenting than just saying "controller()" everywhere. (Actually, I prefer working direct with a named reference to the controller itself, but a lot of times it's easier to call a method using the latter syntax.)

Viewing all articles
Browse latest Browse all 3491

Trending Articles