javascript - Backbone.js does't work -


i have next html page:

...     <script src="/scripts/app/pep.js"></script>      </head>     <body>     <div id="main">         &nbsp;     </div>     </body> ... 

the 'pep.js' contains next content:

var pep = {      models: {     },     views: {          loginview: backbone.view.extend({              tagname: 'div',              id: 'logincontainer',              el: $('#main'),              events: {              },              initialize: function() {                 this.listento(this.model, "change", this.render);             },              render: function () {                 this.$el.html("<p>asd</p>");                 return this;             }          })      },     route: backbone.router.extend({          routes: {             "login": "login",    // #login         },          login: function () {             var lv = new pep.views.loginview;             lv.render();         }      }),     onready: function () {          var r = new pep.route();         backbone.history.start();          r.navigate('login');     } };  $(pep.onready()); 

routing has working, view isn't rendered. there error? backbone.js version 1.2.3 chrome not display errors. debugging allowed see browser enters router , executes method. however, method nothing.

this code works if dependent libraries positioned @ end of body of document, rather in header.


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -