backbone.js - Really strange JS error in Underscore.js file when rendering view -


i have 2 views right now. 1 lists collection of mongodb objects, , other supposed allow editing er. list view works fine, whenever try render edit view, error:

uncaught syntaxerror: unexpected identifier 

and here code failed on (line 1155 of underscore.js):

try {       render = new function(settings.variable || 'obj', '_', source); uncaught syntaxerror: unexpected identifier     } catch (e) {       e.source = source;       throw e;     } 

and here code causes above code run:

render : function(){                          var id = glob;                          var skill = new skillmodel({_id:id});                         skill.fetch();                          console.log("blah");                         var template = _.template($('#edittemplate').html(), {skill: {name:"test", value:"value", id:"123"}});                          this.$el.html(template);                          return this;                     } 

i have found line:

var template = _.template($('#editskilltemplate').html(), {}); 

is line causes happen. strange thing have done listview render function, have no idea problem is. in case useful, here code list view.

render : function(){                 var = this;                  var skillset = new skillset();                 skillset.fetch({success: function(model, result){                  var template = _.template($('#skillstemplate').html(), {items: result });                  that.$el.html(template);                  }})                   return this;                          } 

here template:

<script type="text/template" id="edittemplate">                 <section>                     <form id="editform">                         <label for="skillname"><input id="skillname" type="text" value="<%= skill.name %>" />                         <br />                         <label for="skillvalue"><input id="skillvalue" type="text" value="<%= skill.value $>" />                         <br />                         <a href="#/save/<%= skill.id %>"><button class="save">save</button></a>                         <a href="#/delete/<%= skill.id %>"><button class="delete">delete</button></a>                     </form>                 </section>             </script> 

simple typo:

<%= skill.value $> 

should be

<%= skill.value %> 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -