标签:
<!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); });
标签:
原文地址:http://www.cnblogs.com/Answer1215/p/4758545.html