首页 > Web开发 > 详细

[Ember] Ember.js Templates

时间:2016-09-24 23:16:18      阅读:304      评论:0      收藏:0      [点我收藏+]

In this lesson, we‘ll go over some of the basics of Ember.js templates and how they work with controllers.

 

Generate a controller:

ember g controller hello

 

Generate a Template:

ember g template application

 

Template syntax:

application.hbs:

{{#if showName}}
    <h2>Hello {{name}}</h2>
{{else if}}
    <h2>Hello World</h2>
{{/if}}

{{#unless showAge}}
    <h2>Hello {{name}}, 23</h2>
{{else if}}
    <h2>Hello Ember!</h2>
{{/unless}}

 

application.js:

import Ember from ‘ember‘;

export default Ember.Controller.extend({
  name: "Ember",
  showName: true,
  showAge: false
});

技术分享

 

Github

[Ember] Ember.js Templates

原文:http://www.cnblogs.com/Answer1215/p/5904408.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!