// 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>
これらの2つの異なるアプローチは、ember.jsでのビューレンダリングに関してどのように機能しますか。どちらが望ましいか、そして一方が他方よりも優れているユースケースまたは利点は何ですか。