--- HTML ---
<a id="bubbleUserEvent" href="javascript:void(0);"> notify user action to controller </a> <div id="feedBackMessages"> </div>
--- JavaScript ---
YUI().use('event', function (Y) { var model = { getText: function () { return 'hello world'; } }; var view = { showMessage: function (message) { Y.Node.one('#feedBackMessages').set('innerHTML', message); } }; var controller = { sayHelloWorld: function () { view.showMessage(model.getText()); } }; //Add event handler to view's control Y.on('click', controller.sayHelloWorld, '#bubbleUserEvent'); });
No hay comentarios:
Publicar un comentario