backbone.js - Backbone View returns as a string: function (){ return parent.apply(this, arguments); } -
good day. have next problem. router request view returned "function (){ return parent.apply(this, arguments); }" , have no access methods.
router.js:
// filename: router.js define([ 'jquery', 'underscore', 'backbone', 'views/page/pageview' ], function($, _, backbone, pageview){ var approuter = backbone.router.extend({ routes: { "": "index", "page": "page" }, index: function() { //console.log(pageview); pageview; }, page: function() { alert("page");//welcomeviewinstance.render(); } }); initialize = function(){ var approuterinstance = new approuter(); backbone.history.start(); }; return { initialize: initialize }; });
view.js:
define([ 'jquery', 'underscore', 'backbone', 'text!templates/page/page.html' ], function($, _, backbone, pagetemplate){ var pageview = backbone.view.extend({ test: "test" }); return pageview; });
i stuck it. how can manage it?
you need create instance of pageview
var view = new pageview();
inside index() method or return instance directly view.js (depends how plan build app , behaviour expect).
Comments
Post a Comment