// 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