zoukankan      html  css  js  c++  java
  • Ember.js demo2

    <!DOCTYPE html>
    <html>
    <head>
    <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0-rc.3/handlebars.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/ember.js/1.0.0-rc.1/ember.js"></script>
    <meta charset=utf-8 />
    <title>JS Bin</title>
    </head>
    <body>
      
      <script type="text/x-handlebars">
        <h1>{{name}}</h1>
        <h2>{{timer}}</h2>
      </script>
      
    </body>
    </html>
    var App = Ember.Application.create();
    
    App.ApplicationRoute = Ember.Route.extend({
    
      model: function() {
        return { name: 'My App', timer: 0 };
      },
    
      activate: function() {
        this.interval = setInterval(function() {
          var timer = this.get('controller.model.timer');
          this.set('controller.model.timer', timer + 1);
        }.bind(this), 1000);
      },
      
      deactivate: function() {
        clearInterval(this.interval);
      }
    
    });
  • 相关阅读:
    struts-spring 整合
    Spring与Struts2的整合
    three.js 3d 智慧园区
    前端框架理解
    Flutter仿照airbnb创建app
    软件、语言的安装
    python功能
    python创建项目
    安装python
    mysql的安装和使用
  • 原文地址:https://www.cnblogs.com/wangwenfei/p/emberjs_demo2.html
Copyright © 2011-2022 走看看