您的位置:首页 > Web前端 > AngularJS

[Angular 2] 8. Better ES5 Code

2015-08-25 20:37 543 查看
<!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);
});
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: