码迷,mamicode.com
首页 > 其他好文 > 详细

[Angular 2] Better ES5 Code

时间:2015-08-25 21:34:09      阅读:101      评论:0      收藏:0      [点我收藏+]

标签:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>JS Bin</title>
    <script src="https://code.angularjs.org/2.0.0-alpha.28/angular2.sfx.dev.js"></script>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
</head>
<body>

<egghead></egghead>
<script src="app.js"></script>
</body>
</html>

 

var Note = angular
    .Component({
        selector: ‘note‘
    })
    .View({
        template: ‘<h3>World</h3>‘
    })
    .Class({
        constructor: function() {

        }
    });

var Egghead = angular
    .Component({
        selector: ‘egghead‘
    })
    .View({
        template: ‘<div><h1>Hello</h1><note></note></div>‘,
        directives: [Note]
    })
    .Class({
        constructor: function() {

        }
    });

document.addEventListener("DOMContentLoaded", function() {
    angular.bootstrap(Egghead);
});

 

[Angular 2] Better ES5 Code

标签:

原文地址:http://www.cnblogs.com/Answer1215/p/4758545.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!