[Ember] Ember.js Templates
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[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 });
以上是关于[Ember] Ember.js Templates的主要内容,如果未能解决你的问题,请参考以下文章