I have the following code in my initial project
mytools.hbs
<div class="section">
{{view Mytest.MyformView contentBinding="model"}}
</div>
routes.js
Mytest.MyformRoute = Ember.Route.extend({
model: function() {
return [{defaultvalues:''}];
}
});
views.js
Mytest.MyformView = Ember.View.extend({
isShowVisible: true,
templateName: Ember.TEMPLATES['myform'],
actions: {
ShowDefaultValues: function(){
this.toggleProperty('isShowVisible');
}
}
});
myform.hbs
{{#if view.isShowVisible}}
Name : <font color='blue'>{{view.content.Name}}</font>
Email : <font color='blue'>{{view.content.Email}}</font>
<button {{action "ShowDefaultValues" target="view"}}>Edit</button>
{{else}}
Name : {{input type="text" value=view.content.Name}}
Email : {{input type="text" value=view.content.Email}}
<button {{action "ShowDefaultValues" target="view"}}>Done</button>
{{/if}}
With the above script, the template myform.hbs is not displaying. I am not getting any error in console.
What is wrong with my above code?
I need the views, routes and handlebars in separate files but not in same HTML file under script tag.
I have referred many Q & A in stackoverflow and other sites as well but I could not able to find solution.
EDIT: I am using ember 1.2.1
Aucun commentaire:
Enregistrer un commentaire