zoukankan      html  css  js  c++  java
  • [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

  • 相关阅读:
    多行文字垂直居中效果(利用flex)
    Switch
    Scanner
    Method
    Recursion递归
    for
    if
    dowhile
    while
    DataType 数据类型
  • 原文地址:https://www.cnblogs.com/Answer1215/p/5904408.html
Copyright © 2011-2022 走看看