[Angular 2] 5. Hello World (es5)
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>JS Bin</title> <script src="https://code.angularjs.org/2.0.0-alpha.23/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>
function Note() {} Note.annotations = [ new angular.ComponentAnnotation({ selector: 'note' }), new angular.ViewAnnotation({ template: '<h3>World</h3>' }) ]; function Egghead() {} Egghead.annotations = [ new angular.ComponentAnnotation({ selector: 'egghead' }), new angular.ViewAnnotation({ template: '<div><h1>Hello</h1><note></note></div>', directives: [Note] }) ]; document.addEventListener("DOMContentLoaded", function() { angular.bootstrap(Egghead); });