3
// create Ember js app
App = Ember.Application.create();
// Create a grand parent view - without using templateName function/property
App.GrandparentView = Ember.View.extend({
click: function() {
console.log('Grandparent!');
}
});
// Create a parent view by using templateName function/property
App.ParentView = Ember.View.extend({
templateName:"parent-view",
click: function() {
console.log('parent view!');
}
});
// use the template to render the view content
<script type="text/x-handlebars" >
{{#view App.GrandparentView}}
Click Grandparent View!
{{/view}}
</script>
// embed the view inside a div
<div id="Parent">
<script type="text/x-handlebars">
{{view App.ParentView}}
</script>
</div>
這兩種不同方法在ember.js中的視圖渲染方面如何工作? 哪一個更好,哪個是最好的,哪個更好。ember.js視圖渲染效果如何不同
如果兩者都不是最好,你能告訴我最好的版本。 – varunkaushish