javascript - backbone js Todo Code not displaying in browser -


Iam Backbone JS is learning why the code below is not displayed in the browser? I also used router, but still is not being displayed in the browser. Please tell me what happened wrong BTW, output is showing only in the console Sorry, if its dumb query.

  & lt; Html & gt; & Lt; Top & gt; & Lt; Link rel = "stylesheet" href = "http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.1.1/css/bootstrap.min.css" & gt; & Lt; Script type = "text / javascript" & gt; / * $ GetJSON ('API / user / 1', function (data) {console.log (data);}); * / & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Script src = "http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.7.0/underscore-min.js" & gt; & Lt; / Script & gt; & Lt; Script src = "http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js" & gt; & Lt; / Script & gt; & Lt; Script src = "http://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.2/backbone-min.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; Var TodoItem = Backbone.Model.extend ({toggleStatus: function () {if (this.get ('status') == 'incomplete') {this.set ({'status': 'complete'})}} { This.set ({'status':' incomplete '});}}}) TodoView = Backbone.View.extend ({template: _.template (' & lt; h3 & gt; '+' & lt; input type = Checkbox '+' & lt;% if (status === "full") print ("checked")%>  gt; & gt; '+' & lt;% = description% & gt; ; / H3 & gt; '), render: function () {This. $ El.html (this.template (this.tmodel.toJSON ())}}, Events: {' change imput ':' toggleStatus'}, Toggle Status: Function () {this.model.toggleStatus ();}}) Var todoItem = New TodoItem ({description: 'Raise milk', State we: 'incomplete', id: 1}); Var todoView = New TodoView ({Model: todoItem}); console Log (todoView.el); Var router = backbone.routor.andand ({path: {':' home '}}) var router = new router (); router.n (' path: home ', function ( ) {TodoView.render ();}); Backbone.history.start (); & lt; / script & gt; & gt; & gt; & lt; / html & gt;  

Each view should be presented in one of these fashion, when you want to create a new element, tagname, classname and Specify the ID, and when you attach to view a view, you can choose to select it Should direct (the jquery chooses it). The next point of your code is that you do not return it to the render function. When you have nested scenes, you should return it.

I have tested it in this bin


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -