2016-06-01 16:58:01 -04:00
|
|
|
(function(app) {
|
|
|
|
|
2015-08-08 16:55:53 -04:00
|
|
|
// #docregion
|
|
|
|
// #docregion class-w-annotations
|
2016-06-01 16:58:01 -04:00
|
|
|
app.AppComponent =
|
2015-08-08 16:55:53 -04:00
|
|
|
// #docregion component
|
2016-06-01 16:58:01 -04:00
|
|
|
ng.core.Component({
|
2016-05-21 19:26:54 -04:00
|
|
|
selector: 'my-app',
|
2015-08-08 16:55:53 -04:00
|
|
|
// #enddocregion
|
|
|
|
// #docregion view
|
|
|
|
template: '<h1 id="output">My First Angular 2 App</h1>'
|
|
|
|
})
|
|
|
|
// #enddocregion
|
|
|
|
// #docregion class
|
|
|
|
.Class({
|
|
|
|
constructor: function () { }
|
|
|
|
});
|
|
|
|
// #enddocregion
|
|
|
|
// #enddocregion
|
|
|
|
|
|
|
|
// #docregion bootstrap
|
2016-08-09 12:38:25 -04:00
|
|
|
app.AppModule =
|
|
|
|
ng.core.NgModule({
|
|
|
|
imports: [ ng.platformBrowser.BrowserModule ],
|
|
|
|
declarations: [ app.AppComponent ],
|
|
|
|
bootstrap: [ app.AppComponent ]
|
|
|
|
})
|
|
|
|
.Class({
|
|
|
|
constructor: function() {}
|
|
|
|
});
|
|
|
|
|
2015-08-08 16:55:53 -04:00
|
|
|
document.addEventListener('DOMContentLoaded', function() {
|
2016-08-09 12:38:25 -04:00
|
|
|
ng.platformBrowserDynamic
|
|
|
|
.platformBrowserDynamic()
|
|
|
|
.bootstrapModule(app.AppModule);
|
2015-08-08 16:55:53 -04:00
|
|
|
});
|
|
|
|
// #enddocregion
|
|
|
|
// #enddocregion
|
|
|
|
|
2016-06-01 16:58:01 -04:00
|
|
|
})(window.app || (window.app = {}));
|
2015-08-08 16:55:53 -04:00
|
|
|
|
|
|
|
/* Non DSL Approach */
|
2016-06-01 16:58:01 -04:00
|
|
|
(function(app) {
|
2015-08-08 16:55:53 -04:00
|
|
|
|
|
|
|
// #docregion no-dsl
|
2016-06-01 16:58:01 -04:00
|
|
|
app.AppComponent = function AppComponent () {}
|
2015-08-08 16:55:53 -04:00
|
|
|
|
2016-06-01 16:58:01 -04:00
|
|
|
app.AppComponent.annotations = [
|
|
|
|
new ng.core.Component({
|
|
|
|
selector: 'my-app',
|
2015-08-08 16:55:53 -04:00
|
|
|
template: '<h1 id="output">My First Angular 2 App</h1>'
|
|
|
|
})
|
|
|
|
];
|
|
|
|
// #enddocregion
|
2016-06-01 16:58:01 -04:00
|
|
|
})(window.app || (window.app = {}));
|