Creating Web applications with Ember.js

前端 未结 2 1592
清酒与你
清酒与你 2021-02-04 16:54

I\'ve just found out about Ember.js, and it looks interesting. I\'d like to create a small notes app to learn how to use it.

The basic layout I have in mind is to have c

2条回答
  •  北海茫月
    2021-02-04 17:40

    Besides the approaches @rharper mentioned, you can also use the outlet helper, wich has been introduced in commit 5a4917b.

    You can find an example here:

    Handlebars:

    
    

    JavaScript:

    App.viewController = Ember.Object.create({
        footerView: Ember.View.create({
            templateName: 'footer'
        }),
        contentView: Ember.View.create({
            templateName: 'content'
        })
    });
    
    Ember.View.create({
        controllerBinding: 'App.viewController',
        templateName: 'main'
    }).append();
    
    Ember.run.later(function(){
        App.viewController.set('contentView', Ember.View.create({
            templateName: 'new-content'
        }));
    }, 1000);
    

提交回复
热议问题