refactor(core): remove deprecated 'bootstrap' (#10831)

This commit is contained in:
Victor Savkin
2016-08-16 11:15:01 -07:00
committed by vikerman
parent f6a7d6504c
commit f7ff6c5a12
51 changed files with 426 additions and 418 deletions

View File

@ -6,18 +6,12 @@
* found in the LICENSE file at https://angular.io/license
*/
import {Component, Directive, ElementRef, Injectable, Renderer} from '@angular/core';
import {bootstrap} from '@angular/platform-browser-dynamic';
import {Component, Directive, ElementRef, Injectable, NgModule, Renderer} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
export function main() {
// Bootstrapping only requires specifying a root component.
// The boundary between the Angular application and the rest of the page is
// the shadowDom of this root component.
// The selector of the component passed in is used to find where to insert the
// application.
// You can use the light dom of the <hello-app> tag as temporary content (for
// example 'Loading...') before the application is ready.
bootstrap(HelloCmp);
platformBrowserDynamic().bootstrapModule(ExampleModule);
}
// A service available to the Injector, used by the HelloCmp component.
@ -53,12 +47,7 @@ export class RedDec {
// Expressions in the template (like {{greeting}}) are evaluated in the
// context of the HelloCmp class below.
template: `<div class="greeting">{{greeting}} <span red>world</span>!</div>
<button class="changeButton" (click)="changeGreeting()">change greeting</button>`,
// All directives used in the template need to be specified. This allows for
// modularity (RedDec can only be used in this template)
// and better tooling (the template can be invalidated if the attribute is
// misspelled).
directives: [RedDec]
<button class="changeButton" (click)="changeGreeting()">change greeting</button>`
})
export class HelloCmp {
greeting: string;
@ -67,3 +56,7 @@ export class HelloCmp {
changeGreeting(): void { this.greeting = 'howdy'; }
}
@NgModule({bootstrap: [HelloCmp], declarations: [RedDec], imports: [BrowserModule]})
class ExampleModule {
}