首页 > 代码库 > [Ember] Ember.js Templates
[Ember] Ember.js Templates
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
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。