2015-10-14 23:25:19 -04:00
|
|
|
// #docregion dsl
|
2015-08-08 16:55:53 -04:00
|
|
|
(function() {
|
2015-10-14 23:25:19 -04:00
|
|
|
|
2015-08-08 16:55:53 -04:00
|
|
|
// #docregion class-w-annotations
|
|
|
|
var AppComponent = ng
|
2015-10-16 04:06:56 -04:00
|
|
|
.Component({
|
2015-10-14 23:25:19 -04:00
|
|
|
selector: 'my-app',
|
|
|
|
template: '<h1>My First Angular 2 App</h1>'
|
|
|
|
})
|
|
|
|
.Class({
|
|
|
|
constructor: function () { }
|
|
|
|
});
|
|
|
|
// #enddocregion class-w-annotations
|
2015-08-08 16:55:53 -04:00
|
|
|
|
|
|
|
// #docregion bootstrap
|
|
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
|
|
ng.bootstrap(AppComponent);
|
|
|
|
});
|
2015-10-14 23:25:19 -04:00
|
|
|
// #enddocregion bootstrap
|
2015-08-08 16:55:53 -04:00
|
|
|
|
|
|
|
})();
|
2015-10-14 23:25:19 -04:00
|
|
|
// #enddocregion dsl
|
2015-08-08 16:55:53 -04:00
|
|
|
|
|
|
|
/* Non DSL Approach */
|
|
|
|
(function() {
|
|
|
|
|
|
|
|
// #docregion no-dsl
|
|
|
|
function AppComponent () {}
|
|
|
|
|
|
|
|
AppComponent.annotations = [
|
2015-10-14 23:25:19 -04:00
|
|
|
new ng.Component({
|
|
|
|
selector: 'my-app',
|
2015-08-08 16:55:53 -04:00
|
|
|
template: '<h1 id="output">My First Angular 2 App</h1>'
|
|
|
|
})
|
|
|
|
];
|
|
|
|
// #enddocregion
|
|
|
|
})();
|