docs(rc5): update docs and plunkers for rc5
This commit is contained in:
parent
2fb503dabf
commit
d79adb2422
|
@ -595,7 +595,7 @@ gulp.task('build-dart-api-docs', ['_shred-api-examples', 'dartdoc'], function()
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('build-plunkers', ['_copy-example-boilerplate'], function() {
|
gulp.task('build-plunkers', ['_copy-example-boilerplate'], function() {
|
||||||
return plunkerBuilder.buildPlunkers(EXAMPLES_PATH, LIVE_EXAMPLES_PATH, { errFn: gutil.log });
|
return plunkerBuilder.buildPlunkers(EXAMPLES_PATH, LIVE_EXAMPLES_PATH, { errFn: gutil.log, build: argv.build });
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('build-dart-cheatsheet', [], function() {
|
gulp.task('build-dart-cheatsheet', [], function() {
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
"browser-sync": "^2.9.3",
|
"browser-sync": "^2.9.3",
|
||||||
"canonical-path": "0.0.2",
|
"canonical-path": "0.0.2",
|
||||||
"cheerio": "^0.20.0",
|
"cheerio": "^0.20.0",
|
||||||
"codelyzer": "0.0.22",
|
"codelyzer": "0.0.26",
|
||||||
"cross-spawn": "^4.0.0",
|
"cross-spawn": "^4.0.0",
|
||||||
"del": "^2.2.0",
|
"del": "^2.2.0",
|
||||||
"dgeni": "^0.4.0",
|
"dgeni": "^0.4.0",
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
|
|
||||||
|
import { HeroTeamBuilderComponent } from './hero-team-builder.component';
|
||||||
|
import { HeroListBasicComponent } from './hero-list-basic.component';
|
||||||
|
import { HeroListInlineStylesComponent } from './hero-list-inline-styles.component';
|
||||||
|
import { HeroListEnterLeaveComponent } from './hero-list-enter-leave.component';
|
||||||
|
import { HeroListEnterLeaveStatesComponent } from './hero-list-enter-leave-states.component';
|
||||||
|
import { HeroListCombinedTransitionsComponent } from './hero-list-combined-transitions.component';
|
||||||
|
import { HeroListTwowayComponent } from './hero-list-twoway.component';
|
||||||
|
import { HeroListAutoComponent } from './hero-list-auto.component';
|
||||||
|
import { HeroListGroupsComponent } from './hero-list-groups.component';
|
||||||
|
import { HeroListMultistepComponent } from './hero-list-multistep.component';
|
||||||
|
import { HeroListTimingsComponent } from './hero-list-timings.component';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [ BrowserModule ],
|
||||||
|
declarations: [
|
||||||
|
HeroTeamBuilderComponent,
|
||||||
|
HeroListBasicComponent,
|
||||||
|
HeroListInlineStylesComponent,
|
||||||
|
HeroListCombinedTransitionsComponent,
|
||||||
|
HeroListTwowayComponent,
|
||||||
|
HeroListEnterLeaveComponent,
|
||||||
|
HeroListEnterLeaveStatesComponent,
|
||||||
|
HeroListAutoComponent,
|
||||||
|
HeroListTimingsComponent,
|
||||||
|
HeroListMultistepComponent,
|
||||||
|
HeroListGroupsComponent
|
||||||
|
],
|
||||||
|
bootstrap: [ HeroTeamBuilderComponent ]
|
||||||
|
})
|
||||||
|
export class AppModule { }
|
|
@ -1,16 +1,6 @@
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
import { Heroes } from './hero.service';
|
import { Heroes } from './hero.service';
|
||||||
import { HeroListBasicComponent } from './hero-list-basic.component';
|
|
||||||
import { HeroListInlineStylesComponent } from './hero-list-inline-styles.component';
|
|
||||||
import { HeroListEnterLeaveComponent } from './hero-list-enter-leave.component';
|
|
||||||
import { HeroListEnterLeaveStatesComponent } from './hero-list-enter-leave-states.component';
|
|
||||||
import { HeroListCombinedTransitionsComponent } from './hero-list-combined-transitions.component';
|
|
||||||
import { HeroListTwowayComponent } from './hero-list-twoway.component';
|
|
||||||
import { HeroListAutoComponent } from './hero-list-auto.component';
|
|
||||||
import { HeroListGroupsComponent } from './hero-list-groups.component';
|
|
||||||
import { HeroListMultistepComponent } from './hero-list-multistep.component';
|
|
||||||
import { HeroListTimingsComponent } from './hero-list-timings.component';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'hero-team-builder',
|
selector: 'hero-team-builder',
|
||||||
|
@ -97,18 +87,6 @@ import { HeroListTimingsComponent } from './hero-list-timings.component';
|
||||||
min-height: 6em;
|
min-height: 6em;
|
||||||
}
|
}
|
||||||
`],
|
`],
|
||||||
directives: [
|
|
||||||
HeroListBasicComponent,
|
|
||||||
HeroListInlineStylesComponent,
|
|
||||||
HeroListCombinedTransitionsComponent,
|
|
||||||
HeroListTwowayComponent,
|
|
||||||
HeroListEnterLeaveComponent,
|
|
||||||
HeroListEnterLeaveStatesComponent,
|
|
||||||
HeroListAutoComponent,
|
|
||||||
HeroListTimingsComponent,
|
|
||||||
HeroListMultistepComponent,
|
|
||||||
HeroListGroupsComponent
|
|
||||||
],
|
|
||||||
providers: [Heroes]
|
providers: [Heroes]
|
||||||
})
|
})
|
||||||
export class HeroTeamBuilderComponent {
|
export class HeroTeamBuilderComponent {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import { bootstrap } from '@angular/platform-browser-dynamic';
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||||
|
import { AppModule } from './app.module';
|
||||||
|
|
||||||
import { HeroTeamBuilderComponent } from './hero-team-builder.component';
|
platformBrowserDynamic().bootstrapModule(AppModule);
|
||||||
|
|
||||||
bootstrap(HeroTeamBuilderComponent);
|
|
||||||
|
|
|
@ -1,16 +1,13 @@
|
||||||
// #docregion import
|
// #docregion import
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
// #enddocregion import
|
// #enddocregion import
|
||||||
import { HeroListComponent } from './hero-list.component';
|
|
||||||
import { SalesTaxComponent } from './sales-tax.component';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-app',
|
selector: 'my-app',
|
||||||
template: `
|
template: `
|
||||||
<hero-list></hero-list>
|
<hero-list></hero-list>
|
||||||
<sales-tax></sales-tax>
|
<sales-tax></sales-tax>
|
||||||
`,
|
`
|
||||||
directives: [HeroListComponent, SalesTaxComponent]
|
|
||||||
})
|
})
|
||||||
// #docregion export
|
// #docregion export
|
||||||
export class AppComponent { }
|
export class AppComponent { }
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
|
import { FormsModule } from '@angular/forms';
|
||||||
|
// #docregion imports
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { AppComponent } from './app.component';
|
||||||
|
// #enddocregion imports
|
||||||
|
import { HeroDetailComponent } from './hero-detail.component';
|
||||||
|
import { HeroListComponent } from './hero-list.component';
|
||||||
|
import { SalesTaxComponent } from './sales-tax.component';
|
||||||
|
import { HeroService } from './hero.service';
|
||||||
|
import { BackendService } from './backend.service';
|
||||||
|
import { Logger } from './logger.service';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
BrowserModule,
|
||||||
|
FormsModule
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
AppComponent,
|
||||||
|
HeroDetailComponent,
|
||||||
|
HeroListComponent,
|
||||||
|
SalesTaxComponent
|
||||||
|
],
|
||||||
|
// #docregion providers
|
||||||
|
providers: [
|
||||||
|
BackendService,
|
||||||
|
HeroService,
|
||||||
|
Logger
|
||||||
|
],
|
||||||
|
// #enddocregion providers
|
||||||
|
bootstrap: [ AppComponent ]
|
||||||
|
})
|
||||||
|
// #docregion export
|
||||||
|
export class AppModule { }
|
||||||
|
// #enddocregion export
|
|
@ -4,8 +4,7 @@ import { Hero } from './hero';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'hero-detail',
|
selector: 'hero-detail',
|
||||||
templateUrl: 'app/hero-detail.component.html',
|
templateUrl: 'app/hero-detail.component.html'
|
||||||
directives: [HeroDetailComponent]
|
|
||||||
})
|
})
|
||||||
export class HeroDetailComponent {
|
export class HeroDetailComponent {
|
||||||
@Input() hero: Hero;
|
@Input() hero: Hero;
|
||||||
|
|
|
@ -1,18 +1,15 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
|
||||||
import { Hero } from './hero';
|
import { Hero } from './hero';
|
||||||
import { HeroDetailComponent } from './hero-detail.component';
|
|
||||||
import { HeroService } from './hero.service';
|
import { HeroService } from './hero.service';
|
||||||
|
|
||||||
// #docregion metadata
|
// #docregion metadata, providers
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'hero-list',
|
selector: 'hero-list',
|
||||||
templateUrl: 'app/hero-list.component.html',
|
templateUrl: 'app/hero-list.component.html',
|
||||||
directives: [HeroDetailComponent],
|
providers: [ HeroService ]
|
||||||
// #docregion providers
|
|
||||||
providers: [HeroService]
|
|
||||||
// #enddocregion providers
|
|
||||||
})
|
})
|
||||||
|
// #enddocregion providers
|
||||||
// #docregion class
|
// #docregion class
|
||||||
export class HeroListComponent implements OnInit {
|
export class HeroListComponent implements OnInit {
|
||||||
// #enddocregion metadata
|
// #enddocregion metadata
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
import { bootstrap } from '@angular/platform-browser-dynamic';
|
// #docregion
|
||||||
// #docregion import
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||||
import { AppComponent } from './app.component';
|
import { AppModule } from './app.module';
|
||||||
// #enddocregion import
|
|
||||||
import { HeroService } from './hero.service';
|
|
||||||
import { BackendService } from './backend.service';
|
|
||||||
import { Logger } from './logger.service';
|
|
||||||
|
|
||||||
// #docregion bootstrap
|
platformBrowserDynamic().bootstrapModule(AppModule);
|
||||||
bootstrap(AppComponent, [BackendService, HeroService, Logger]);
|
|
||||||
// #enddocregion bootstrap
|
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
// #docplaster
|
||||||
|
// A mini-application
|
||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class Logger {
|
||||||
|
log(message: string) { console.log(message); }
|
||||||
|
}
|
||||||
|
|
||||||
|
// #docregion import-core-component
|
||||||
|
import { Component } from '@angular/core';
|
||||||
|
// #enddocregion import-core-component
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'my-app',
|
||||||
|
template: 'Welcome to Angular 2'
|
||||||
|
})
|
||||||
|
export class AppComponent {
|
||||||
|
constructor(logger: Logger) {
|
||||||
|
logger.log('Let the fun begin!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// #docregion module
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
// #docregion import-browser-module
|
||||||
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
|
// #enddocregion import-browser-module
|
||||||
|
@NgModule({
|
||||||
|
// #docregion ngmodule-imports
|
||||||
|
imports: [ BrowserModule ],
|
||||||
|
// #enddocregion ngmodule-imports
|
||||||
|
providers: [ Logger ],
|
||||||
|
declarations: [ AppComponent ],
|
||||||
|
exports: [ AppComponent ],
|
||||||
|
bootstrap: [ AppComponent ]
|
||||||
|
})
|
||||||
|
// #docregion export
|
||||||
|
export class AppModule { }
|
||||||
|
// #enddocregion export
|
||||||
|
// #enddocregion module
|
||||||
|
|
||||||
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||||
|
|
||||||
|
platformBrowserDynamic().bootstrapModule(AppModule);
|
|
@ -14,7 +14,7 @@ import { TaxRateService } from './tax-rate.service';
|
||||||
{{ getTax(amountBox.value) | currency:'USD':true:'1.2-2' }}
|
{{ getTax(amountBox.value) | currency:'USD':true:'1.2-2' }}
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
providers: [SalesTaxService, TaxRateService]
|
providers: [SalesTaxService, TaxRateService]
|
||||||
})
|
})
|
||||||
export class SalesTaxComponent {
|
export class SalesTaxComponent {
|
||||||
constructor(private salesTaxService: SalesTaxService) { }
|
constructor(private salesTaxService: SalesTaxService) { }
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<!-- #docregion -->
|
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<base href="/">
|
<title>Architecture of Angular 2</title>
|
||||||
<title>Router Sample v.3</title>
|
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<link rel="stylesheet" href="styles.css">
|
<link rel="stylesheet" href="styles.css">
|
||||||
|
@ -17,15 +15,12 @@
|
||||||
|
|
||||||
<script src="systemjs.config.js"></script>
|
<script src="systemjs.config.js"></script>
|
||||||
<script>
|
<script>
|
||||||
System.import('app/main.3') // <----- ONLY CHANGE
|
System.import('app/mini-app').catch(function(err){ console.error(err); });
|
||||||
.catch(function(err){ console.error(err); });
|
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<h1>Milestone 3</h1>
|
<my-app>Loading...</my-app>
|
||||||
<my-app>loading...</my-app>
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
<!-- #enddocregion -->
|
|
|
@ -1,14 +1,10 @@
|
||||||
// #docregion
|
// #docregion
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
import { HighlightDirective } from './highlight.directive';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-app',
|
selector: 'my-app',
|
||||||
templateUrl: 'app/app.component.html',
|
templateUrl: 'app/app.component.html'
|
||||||
directives: [HighlightDirective]
|
|
||||||
})
|
})
|
||||||
|
|
||||||
export class AppComponent { }
|
export class AppComponent { }
|
||||||
|
|
||||||
// #enddocregion
|
// #enddocregion
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
// #docregion
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
|
|
||||||
|
import { AppComponent } from './app.component';
|
||||||
|
import { HighlightDirective } from './highlight.directive';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [ BrowserModule ],
|
||||||
|
declarations: [
|
||||||
|
AppComponent,
|
||||||
|
HighlightDirective
|
||||||
|
],
|
||||||
|
bootstrap: [ AppComponent ]
|
||||||
|
})
|
||||||
|
export class AppModule { }
|
|
@ -1,7 +1,5 @@
|
||||||
// #docregion
|
// #docregion
|
||||||
import { bootstrap } from '@angular/platform-browser-dynamic';
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||||
|
import { AppModule } from './app.module';
|
||||||
import { AppComponent } from './app.component';
|
|
||||||
|
|
||||||
bootstrap(AppComponent);
|
|
||||||
|
|
||||||
|
platformBrowserDynamic().bootstrapModule(AppModule);
|
||||||
|
|
|
@ -1,17 +1,12 @@
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { ROUTER_DIRECTIVES } from '@angular/router';
|
|
||||||
|
|
||||||
import { MovieListComponent } from './movie-list.component';
|
|
||||||
import { MovieService } from './movie.service';
|
import { MovieService } from './movie.service';
|
||||||
import { IMovie } from './movie';
|
import { IMovie } from './movie';
|
||||||
import { StringSafeDatePipe } from './date.pipe';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-app',
|
selector: 'my-app',
|
||||||
templateUrl: 'app/app.component.html',
|
templateUrl: 'app/app.component.html',
|
||||||
styleUrls: ['app/app.component.css'],
|
styleUrls: ['app/app.component.css'],
|
||||||
directives: [MovieListComponent, ROUTER_DIRECTIVES],
|
|
||||||
pipes: [StringSafeDatePipe],
|
|
||||||
providers: [MovieService]
|
providers: [MovieService]
|
||||||
})
|
})
|
||||||
export class AppComponent {
|
export class AppComponent {
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
// #docregion
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
|
|
||||||
|
import { AppComponent } from './app.component';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [ BrowserModule ],
|
||||||
|
declarations: [ AppComponent ],
|
||||||
|
bootstrap: [ AppComponent ]
|
||||||
|
})
|
||||||
|
export class AppModule { }
|
|
@ -0,0 +1,23 @@
|
||||||
|
// #docregion
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
|
import { FormsModule } from '@angular/forms';
|
||||||
|
import { RouterModule } from '@angular/router';
|
||||||
|
|
||||||
|
import { AppComponent } from './app.component';
|
||||||
|
import { MovieListComponent } from './movie-list.component';
|
||||||
|
import { routes } from './app.routes';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
BrowserModule,
|
||||||
|
FormsModule,
|
||||||
|
RouterModule.forRoot(routes, {})
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
AppComponent,
|
||||||
|
MovieListComponent
|
||||||
|
],
|
||||||
|
bootstrap: [ AppComponent ]
|
||||||
|
})
|
||||||
|
export class AppModule { }
|
|
@ -1,13 +1,9 @@
|
||||||
// #docregion
|
// #docregion
|
||||||
import { provideRouter, RouterConfig } from '@angular/router';
|
import { RouterConfig } from '@angular/router';
|
||||||
|
|
||||||
import { MovieListComponent } from './movie-list.component';
|
import { MovieListComponent } from './movie-list.component';
|
||||||
|
|
||||||
const routes: RouterConfig = [
|
export const routes: RouterConfig = [
|
||||||
{ path: '', redirectTo: '/movies', pathMatch: 'full' },
|
{ path: '', redirectTo: '/movies', pathMatch: 'full' },
|
||||||
{ path: 'movies', component: MovieListComponent }
|
{ path: 'movies', component: MovieListComponent }
|
||||||
];
|
];
|
||||||
|
|
||||||
export const appRouterProviders = [
|
|
||||||
provideRouter(routes)
|
|
||||||
];
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
// #docregion
|
|
||||||
import { bootstrap } from '@angular/platform-browser-dynamic';
|
|
||||||
import { AppComponent } from './app.component';
|
|
||||||
|
|
||||||
bootstrap(AppComponent);
|
|
|
@ -1,8 +1,5 @@
|
||||||
// #docregion
|
// #docregion
|
||||||
import { bootstrap } from '@angular/platform-browser-dynamic';
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||||
import { AppComponent } from './app.component';
|
import { AppModule } from './app.module';
|
||||||
import { appRouterProviders } from './app.routes';
|
|
||||||
|
|
||||||
bootstrap(AppComponent, [
|
platformBrowserDynamic().bootstrapModule(AppModule);
|
||||||
appRouterProviders
|
|
||||||
]);
|
|
||||||
|
|
|
@ -3,10 +3,8 @@
|
||||||
// #docregion import
|
// #docregion import
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
// #enddocregion import
|
// #enddocregion import
|
||||||
import { MovieService } from './movie.service';
|
|
||||||
import { IMovie } from './movie';
|
import { IMovie } from './movie';
|
||||||
import { StringSafeDatePipe } from './date.pipe';
|
import { MovieService } from './movie.service';
|
||||||
|
|
||||||
|
|
||||||
// #docregion component
|
// #docregion component
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -16,9 +14,6 @@ import { StringSafeDatePipe } from './date.pipe';
|
||||||
// #docregion style-url
|
// #docregion style-url
|
||||||
styleUrls: ['app/movie-list.component.css'],
|
styleUrls: ['app/movie-list.component.css'],
|
||||||
// #enddocregion style-url
|
// #enddocregion style-url
|
||||||
// #docregion date-pipe
|
|
||||||
pipes: [StringSafeDatePipe]
|
|
||||||
// #enddocregion date-pipe
|
|
||||||
})
|
})
|
||||||
// #enddocregion component
|
// #enddocregion component
|
||||||
// #docregion class
|
// #docregion class
|
||||||
|
|
|
@ -1,32 +1,7 @@
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
import { HeroParentComponent } from './hero-parent.component';
|
|
||||||
import { NameParentComponent } from './name-parent.component';
|
|
||||||
import { VersionParentComponent } from './version-parent.component';
|
|
||||||
import { VoteTakerComponent } from './votetaker.component';
|
|
||||||
import { CountdownLocalVarParentComponent,
|
|
||||||
CountdownViewChildParentComponent } from './countdown-parent.component';
|
|
||||||
import { MissionControlComponent } from './missioncontrol.component';
|
|
||||||
|
|
||||||
let directives: any[] = [
|
|
||||||
HeroParentComponent,
|
|
||||||
NameParentComponent,
|
|
||||||
VersionParentComponent,
|
|
||||||
VoteTakerComponent,
|
|
||||||
MissionControlComponent,
|
|
||||||
];
|
|
||||||
|
|
||||||
// Include Countdown examples
|
|
||||||
// unless in e2e tests which they break.
|
|
||||||
if (!/e2e/.test(location.search)) {
|
|
||||||
console.log('adding countdown timer examples');
|
|
||||||
directives.push(CountdownLocalVarParentComponent);
|
|
||||||
directives.push(CountdownViewChildParentComponent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-app',
|
selector: 'my-app',
|
||||||
templateUrl: 'app/app.component.html',
|
templateUrl: 'app/app.component.html'
|
||||||
directives: directives
|
|
||||||
})
|
})
|
||||||
export class AppComponent { }
|
export class AppComponent { }
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
|
|
||||||
|
import { AppComponent } from './app.component';
|
||||||
|
import { AstronautComponent } from './astronaut.component';
|
||||||
|
import { CountdownLocalVarParentComponent, CountdownViewChildParentComponent } from './countdown-parent.component';
|
||||||
|
import { CountdownTimerComponent } from './countdown-timer.component';
|
||||||
|
import { HeroChildComponent } from './hero-child.component';
|
||||||
|
import { HeroParentComponent } from './hero-parent.component';
|
||||||
|
import { MissionControlComponent } from './missioncontrol.component';
|
||||||
|
import { NameChildComponent } from './name-child.component';
|
||||||
|
import { NameParentComponent } from './name-parent.component';
|
||||||
|
import { VersionChildComponent } from './version-child.component';
|
||||||
|
import { VersionParentComponent } from './version-parent.component';
|
||||||
|
import { VoterComponent } from './voter.component';
|
||||||
|
import { VoteTakerComponent } from './votetaker.component';
|
||||||
|
|
||||||
|
let directives: any[] = [
|
||||||
|
AppComponent,
|
||||||
|
AstronautComponent,
|
||||||
|
CountdownTimerComponent,
|
||||||
|
HeroChildComponent,
|
||||||
|
HeroParentComponent,
|
||||||
|
MissionControlComponent,
|
||||||
|
NameChildComponent,
|
||||||
|
NameParentComponent,
|
||||||
|
VersionChildComponent,
|
||||||
|
VersionParentComponent,
|
||||||
|
VoterComponent,
|
||||||
|
VoteTakerComponent
|
||||||
|
];
|
||||||
|
|
||||||
|
// Include Countdown examples
|
||||||
|
// unless in e2e tests which they break.
|
||||||
|
if (!/e2e/.test(location.search)) {
|
||||||
|
console.log('adding countdown timer examples');
|
||||||
|
directives.push(CountdownLocalVarParentComponent);
|
||||||
|
directives.push(CountdownViewChildParentComponent);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
BrowserModule
|
||||||
|
],
|
||||||
|
declarations: directives,
|
||||||
|
bootstrap: [ AppComponent ]
|
||||||
|
})
|
||||||
|
export class AppModule { }
|
|
@ -19,7 +19,6 @@ import { CountdownTimerComponent } from './countdown-timer.component';
|
||||||
<div class="seconds">{{timer.seconds}}</div>
|
<div class="seconds">{{timer.seconds}}</div>
|
||||||
<countdown-timer #timer></countdown-timer>
|
<countdown-timer #timer></countdown-timer>
|
||||||
`,
|
`,
|
||||||
directives: [CountdownTimerComponent],
|
|
||||||
styleUrls: ['demo.css']
|
styleUrls: ['demo.css']
|
||||||
})
|
})
|
||||||
export class CountdownLocalVarParentComponent { }
|
export class CountdownLocalVarParentComponent { }
|
||||||
|
@ -36,7 +35,6 @@ export class CountdownLocalVarParentComponent { }
|
||||||
<div class="seconds">{{ seconds() }}</div>
|
<div class="seconds">{{ seconds() }}</div>
|
||||||
<countdown-timer></countdown-timer>
|
<countdown-timer></countdown-timer>
|
||||||
`,
|
`,
|
||||||
directives: [CountdownTimerComponent],
|
|
||||||
styleUrls: ['demo.css']
|
styleUrls: ['demo.css']
|
||||||
})
|
})
|
||||||
export class CountdownViewChildParentComponent implements AfterViewInit {
|
export class CountdownViewChildParentComponent implements AfterViewInit {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// #docregion
|
// #docregion
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
import { HeroChildComponent } from './hero-child.component';
|
|
||||||
import { HEROES } from './hero';
|
import { HEROES } from './hero';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -12,8 +11,7 @@ import { HEROES } from './hero';
|
||||||
[hero]="hero"
|
[hero]="hero"
|
||||||
[master]="master">
|
[master]="master">
|
||||||
</hero-child>
|
</hero-child>
|
||||||
`,
|
`
|
||||||
directives: [HeroChildComponent]
|
|
||||||
})
|
})
|
||||||
export class HeroParentComponent {
|
export class HeroParentComponent {
|
||||||
heroes = HEROES;
|
heroes = HEROES;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { bootstrap } from '@angular/platform-browser-dynamic';
|
import { browserDynamicPlatform } from '@angular/platform-browser-dynamic';
|
||||||
|
|
||||||
import { AppComponent } from './app.component';
|
import { AppModule } from './app.module';
|
||||||
|
|
||||||
bootstrap(AppComponent);
|
browserDynamicPlatform().bootstrapModule(AppModule);
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// #docregion
|
// #docregion
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
import { AstronautComponent } from './astronaut.component';
|
|
||||||
import { MissionService } from './mission.service';
|
import { MissionService } from './mission.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -17,7 +16,6 @@ import { MissionService } from './mission.service';
|
||||||
<li *ngFor="let event of history">{{event}}</li>
|
<li *ngFor="let event of history">{{event}}</li>
|
||||||
</ul>
|
</ul>
|
||||||
`,
|
`,
|
||||||
directives: [AstronautComponent],
|
|
||||||
providers: [MissionService]
|
providers: [MissionService]
|
||||||
})
|
})
|
||||||
export class MissionControlComponent {
|
export class MissionControlComponent {
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
// #docregion
|
// #docregion
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
import { NameChildComponent } from './name-child.component';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'name-parent',
|
selector: 'name-parent',
|
||||||
template: `
|
template: `
|
||||||
|
@ -10,8 +8,7 @@ import { NameChildComponent } from './name-child.component';
|
||||||
<name-child *ngFor="let name of names"
|
<name-child *ngFor="let name of names"
|
||||||
[name]="name">
|
[name]="name">
|
||||||
</name-child>
|
</name-child>
|
||||||
`,
|
`
|
||||||
directives: [NameChildComponent]
|
|
||||||
})
|
})
|
||||||
export class NameParentComponent {
|
export class NameParentComponent {
|
||||||
// Displays 'Mr. IQ', '<no name set>', 'Bombasto'
|
// Displays 'Mr. IQ', '<no name set>', 'Bombasto'
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
// #docregion
|
// #docregion
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
import { VersionChildComponent } from './version-child.component';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'version-parent',
|
selector: 'version-parent',
|
||||||
template: `
|
template: `
|
||||||
|
@ -10,8 +8,7 @@ import { VersionChildComponent } from './version-child.component';
|
||||||
<button (click)="newMinor()">New minor version</button>
|
<button (click)="newMinor()">New minor version</button>
|
||||||
<button (click)="newMajor()">New major version</button>
|
<button (click)="newMajor()">New major version</button>
|
||||||
<version-child [major]="major" [minor]="minor"></version-child>
|
<version-child [major]="major" [minor]="minor"></version-child>
|
||||||
`,
|
`
|
||||||
directives: [VersionChildComponent]
|
|
||||||
})
|
})
|
||||||
export class VersionParentComponent {
|
export class VersionParentComponent {
|
||||||
major: number = 1;
|
major: number = 1;
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
// #docregion
|
// #docregion
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
import { VoterComponent } from './voter.component';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'vote-taker',
|
selector: 'vote-taker',
|
||||||
template: `
|
template: `
|
||||||
|
@ -12,8 +10,7 @@ import { VoterComponent } from './voter.component';
|
||||||
[name]="voter"
|
[name]="voter"
|
||||||
(onVoted)="onVoted($event)">
|
(onVoted)="onVoted($event)">
|
||||||
</my-voter>
|
</my-voter>
|
||||||
`,
|
`
|
||||||
directives: [VoterComponent]
|
|
||||||
})
|
})
|
||||||
export class VoteTakerComponent {
|
export class VoteTakerComponent {
|
||||||
agreed = 0;
|
agreed = 0;
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
|
|
||||||
|
import { AppComponent } from './app.component';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
BrowserModule
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
AppComponent
|
||||||
|
],
|
||||||
|
bootstrap: [ AppComponent ]
|
||||||
|
})
|
||||||
|
export class AppModule { }
|
|
@ -1,5 +1,5 @@
|
||||||
import { bootstrap } from '@angular/platform-browser-dynamic';
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||||
|
|
||||||
import { AppComponent } from './app.component';
|
import { AppModule } from './app.module';
|
||||||
|
|
||||||
bootstrap(AppComponent);
|
platformBrowserDynamic().bootstrapModule(AppModule);
|
||||||
|
|
|
@ -1,22 +1,6 @@
|
||||||
// #docregion
|
// #docregion
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
import { HeroBiosComponent,
|
|
||||||
HeroBiosAndContactsComponent } from './hero-bios.component';
|
|
||||||
import { HeroOfTheMonthComponent } from './hero-of-the-month.component';
|
|
||||||
import { HeroesBaseComponent,
|
|
||||||
SortedHeroesComponent } from './sorted-heroes.component';
|
|
||||||
import { HighlightDirective } from './highlight.directive';
|
|
||||||
import { ParentFinderComponent } from './parent-finder.component';
|
|
||||||
|
|
||||||
const DIRECTIVES = [
|
|
||||||
HeroBiosComponent, HeroBiosAndContactsComponent,
|
|
||||||
HeroesBaseComponent, SortedHeroesComponent,
|
|
||||||
HeroOfTheMonthComponent,
|
|
||||||
HighlightDirective,
|
|
||||||
ParentFinderComponent
|
|
||||||
];
|
|
||||||
|
|
||||||
// #docregion import-services
|
// #docregion import-services
|
||||||
import { LoggerService } from './logger.service';
|
import { LoggerService } from './logger.service';
|
||||||
import { UserContextService } from './user-context.service';
|
import { UserContextService } from './user-context.service';
|
||||||
|
@ -25,7 +9,6 @@ import { UserService } from './user.service';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-app',
|
selector: 'my-app',
|
||||||
templateUrl: 'app/app.component.html',
|
templateUrl: 'app/app.component.html',
|
||||||
directives: DIRECTIVES,
|
|
||||||
// #docregion providers
|
// #docregion providers
|
||||||
providers: [LoggerService, UserContextService, UserService]
|
providers: [LoggerService, UserContextService, UserService]
|
||||||
// #enddocregion providers
|
// #enddocregion providers
|
||||||
|
|
|
@ -0,0 +1,74 @@
|
||||||
|
// #docregion
|
||||||
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
|
import { FormsModule } from '@angular/forms';
|
||||||
|
import { XHRBackend } from '@angular/http';
|
||||||
|
// import { appRouterProviders } from './app.routes';
|
||||||
|
import { LocationStrategy,
|
||||||
|
HashLocationStrategy } from '@angular/common';
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
|
||||||
|
import { HeroData } from './hero-data';
|
||||||
|
import { InMemoryBackendService,
|
||||||
|
SEED_DATA } from 'angular2-in-memory-web-api';
|
||||||
|
|
||||||
|
import { AppComponent } from './app.component';
|
||||||
|
import { HeroBioComponent } from './hero-bio.component';
|
||||||
|
import { HeroBiosComponent,
|
||||||
|
HeroBiosAndContactsComponent } from './hero-bios.component';
|
||||||
|
import { HeroOfTheMonthComponent } from './hero-of-the-month.component';
|
||||||
|
import { HeroContactComponent } from './hero-contact.component';
|
||||||
|
import { HeroesBaseComponent,
|
||||||
|
SortedHeroesComponent } from './sorted-heroes.component';
|
||||||
|
import { HighlightDirective } from './highlight.directive';
|
||||||
|
import { ParentFinderComponent,
|
||||||
|
AlexComponent,
|
||||||
|
AliceComponent,
|
||||||
|
CarolComponent,
|
||||||
|
ChrisComponent,
|
||||||
|
CraigComponent,
|
||||||
|
CathyComponent,
|
||||||
|
BarryComponent,
|
||||||
|
BethComponent,
|
||||||
|
BobComponent } from './parent-finder.component';
|
||||||
|
|
||||||
|
const DIRECTIVES = [
|
||||||
|
HeroBiosComponent, HeroBiosAndContactsComponent, HeroBioComponent,
|
||||||
|
HeroesBaseComponent, SortedHeroesComponent,
|
||||||
|
HeroOfTheMonthComponent, HeroContactComponent,
|
||||||
|
HighlightDirective,
|
||||||
|
ParentFinderComponent,
|
||||||
|
AppComponent
|
||||||
|
];
|
||||||
|
|
||||||
|
const B_DIRECTIVES = [ BarryComponent, BethComponent, BobComponent ];
|
||||||
|
|
||||||
|
// #docregion C_DIRECTIVES
|
||||||
|
const C_DIRECTIVES = [
|
||||||
|
CarolComponent, ChrisComponent, CraigComponent,
|
||||||
|
CathyComponent
|
||||||
|
];
|
||||||
|
// #enddocregion C_DIRECTIVES
|
||||||
|
|
||||||
|
// #docregion bootstrap
|
||||||
|
@NgModule({
|
||||||
|
imports: [ BrowserModule, FormsModule ],
|
||||||
|
declarations: [ ...DIRECTIVES,
|
||||||
|
...B_DIRECTIVES,
|
||||||
|
...C_DIRECTIVES,
|
||||||
|
AliceComponent,
|
||||||
|
AlexComponent ],
|
||||||
|
bootstrap: [ AppComponent ],
|
||||||
|
providers: [
|
||||||
|
// appRouterProviders, TODO: add routes
|
||||||
|
{ provide: LocationStrategy, useClass: HashLocationStrategy },
|
||||||
|
|
||||||
|
{ provide: XHRBackend, useClass: InMemoryBackendService }, // in-mem server
|
||||||
|
{ provide: SEED_DATA, useClass: HeroData } // in-mem server data
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class AppModule {
|
||||||
|
constructor() {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// #enddocregion bootstraps
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
// #docregion
|
// #docregion
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
import { HeroContactComponent } from './hero-contact.component';
|
|
||||||
import { HeroBioComponent } from './hero-bio.component';
|
|
||||||
import { HeroService } from './hero.service';
|
import { HeroService } from './hero.service';
|
||||||
import { LoggerService } from './logger.service';
|
import { LoggerService } from './logger.service';
|
||||||
|
|
||||||
|
@ -15,7 +13,6 @@ import { LoggerService } from './logger.service';
|
||||||
<hero-bio [heroId]="1"></hero-bio>
|
<hero-bio [heroId]="1"></hero-bio>
|
||||||
<hero-bio [heroId]="2"></hero-bio>
|
<hero-bio [heroId]="2"></hero-bio>
|
||||||
<hero-bio [heroId]="3"></hero-bio>`,
|
<hero-bio [heroId]="3"></hero-bio>`,
|
||||||
directives: [HeroBioComponent],
|
|
||||||
providers: [HeroService]
|
providers: [HeroService]
|
||||||
})
|
})
|
||||||
export class HeroBiosComponent {
|
export class HeroBiosComponent {
|
||||||
|
@ -39,7 +36,6 @@ export class HeroBiosComponent {
|
||||||
<hero-bio [heroId]="2"> <hero-contact></hero-contact> </hero-bio>
|
<hero-bio [heroId]="2"> <hero-contact></hero-contact> </hero-bio>
|
||||||
<hero-bio [heroId]="3"> <hero-contact></hero-contact> </hero-bio>`,
|
<hero-bio [heroId]="3"> <hero-contact></hero-contact> </hero-bio>`,
|
||||||
// #enddocregion template
|
// #enddocregion template
|
||||||
directives: [HeroBioComponent, HeroContactComponent],
|
|
||||||
// #docregion class-provider
|
// #docregion class-provider
|
||||||
providers: [HeroService]
|
providers: [HeroService]
|
||||||
// #enddocregion class-provider
|
// #enddocregion class-provider
|
||||||
|
|
|
@ -1,22 +1,5 @@
|
||||||
// #docregion
|
// #docregion
|
||||||
import { bootstrap } from '@angular/platform-browser-dynamic';
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||||
import { XHRBackend } from '@angular/http';
|
import { AppModule } from './app.module';
|
||||||
import { appRouterProviders } from './app.routes';
|
|
||||||
import { LocationStrategy,
|
|
||||||
HashLocationStrategy } from '@angular/common';
|
|
||||||
|
|
||||||
import { HeroData } from './hero-data';
|
platformBrowserDynamic().bootstrapModule(AppModule);
|
||||||
import { InMemoryBackendService,
|
|
||||||
SEED_DATA } from 'angular2-in-memory-web-api';
|
|
||||||
|
|
||||||
import { AppComponent } from './app.component';
|
|
||||||
|
|
||||||
// #docregion bootstrap
|
|
||||||
bootstrap(AppComponent, [
|
|
||||||
appRouterProviders,
|
|
||||||
{ provide: LocationStrategy, useClass: HashLocationStrategy },
|
|
||||||
|
|
||||||
{ provide: XHRBackend, useClass: InMemoryBackendService }, // in-mem server
|
|
||||||
{ provide: SEED_DATA, useClass: HeroData } // in-mem server data
|
|
||||||
]).catch((err: any) => console.error(err));
|
|
||||||
// #enddocregion bootstrap
|
|
||||||
|
|
|
@ -85,13 +85,6 @@ export class CraigComponent {
|
||||||
}
|
}
|
||||||
// #enddocregion craig
|
// #enddocregion craig
|
||||||
|
|
||||||
// #docregion C_DIRECTIVES
|
|
||||||
const C_DIRECTIVES = [
|
|
||||||
CarolComponent, ChrisComponent, CraigComponent,
|
|
||||||
forwardRef(() => CathyComponent)
|
|
||||||
];
|
|
||||||
// #enddocregion C_DIRECTIVES
|
|
||||||
|
|
||||||
//////// B - Parent /////////
|
//////// B - Parent /////////
|
||||||
// #docregion barry
|
// #docregion barry
|
||||||
const templateB = `
|
const templateB = `
|
||||||
|
@ -107,7 +100,6 @@ const templateB = `
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'barry',
|
selector: 'barry',
|
||||||
template: templateB,
|
template: templateB,
|
||||||
directives: C_DIRECTIVES,
|
|
||||||
providers: [{ provide: Parent, useExisting: forwardRef(() => BarryComponent) }]
|
providers: [{ provide: Parent, useExisting: forwardRef(() => BarryComponent) }]
|
||||||
})
|
})
|
||||||
export class BarryComponent implements Parent {
|
export class BarryComponent implements Parent {
|
||||||
|
@ -121,7 +113,6 @@ export class BarryComponent implements Parent {
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'bob',
|
selector: 'bob',
|
||||||
template: templateB,
|
template: templateB,
|
||||||
directives: C_DIRECTIVES,
|
|
||||||
providers: [ provideParent(BobComponent) ]
|
providers: [ provideParent(BobComponent) ]
|
||||||
})
|
})
|
||||||
export class BobComponent implements Parent {
|
export class BobComponent implements Parent {
|
||||||
|
@ -132,7 +123,6 @@ export class BobComponent implements Parent {
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'beth',
|
selector: 'beth',
|
||||||
template: templateB,
|
template: templateB,
|
||||||
directives: C_DIRECTIVES,
|
|
||||||
// #docregion beth-providers
|
// #docregion beth-providers
|
||||||
providers: [ provideParent(BethComponent, DifferentParent) ]
|
providers: [ provideParent(BethComponent, DifferentParent) ]
|
||||||
// #enddocregion beth-providers
|
// #enddocregion beth-providers
|
||||||
|
@ -142,8 +132,6 @@ export class BethComponent implements Parent {
|
||||||
constructor( @SkipSelf() @Optional() public parent: Parent ) { }
|
constructor( @SkipSelf() @Optional() public parent: Parent ) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
const B_DIRECTIVES = [ BarryComponent, BethComponent, BobComponent ];
|
|
||||||
|
|
||||||
///////// A - Grandparent //////
|
///////// A - Grandparent //////
|
||||||
|
|
||||||
// #docregion alex, alex-1
|
// #docregion alex, alex-1
|
||||||
|
@ -161,7 +149,6 @@ const B_DIRECTIVES = [ BarryComponent, BethComponent, BobComponent ];
|
||||||
providers: [{ provide: Parent, useExisting: forwardRef(() => AlexComponent) }],
|
providers: [{ provide: Parent, useExisting: forwardRef(() => AlexComponent) }],
|
||||||
// #enddocregion alex-providers
|
// #enddocregion alex-providers
|
||||||
// #docregion alex-1
|
// #docregion alex-1
|
||||||
directives: C_DIRECTIVES
|
|
||||||
})
|
})
|
||||||
// #enddocregion alex-1
|
// #enddocregion alex-1
|
||||||
// Todo: Add `... implements Parent` to class signature
|
// Todo: Add `... implements Parent` to class signature
|
||||||
|
@ -187,7 +174,6 @@ export class AlexComponent extends Base
|
||||||
<bob></bob>
|
<bob></bob>
|
||||||
<carol></carol>
|
<carol></carol>
|
||||||
</div> `,
|
</div> `,
|
||||||
directives: [ B_DIRECTIVES, C_DIRECTIVES ],
|
|
||||||
// #docregion alice-providers
|
// #docregion alice-providers
|
||||||
providers: [ provideParent(AliceComponent) ]
|
providers: [ provideParent(AliceComponent) ]
|
||||||
// #enddocregion alice-providers
|
// #enddocregion alice-providers
|
||||||
|
@ -224,7 +210,6 @@ export class CathyComponent {
|
||||||
template: `
|
template: `
|
||||||
<h2>Parent Finder</h2>
|
<h2>Parent Finder</h2>
|
||||||
<alex></alex>
|
<alex></alex>
|
||||||
<alice></alice>`,
|
<alice></alice>`
|
||||||
directives: [ AlexComponent, AliceComponent ]
|
|
||||||
})
|
})
|
||||||
export class ParentFinderComponent { }
|
export class ParentFinderComponent { }
|
||||||
|
|
|
@ -2,5 +2,4 @@ import { bootstrap } from '@angular/platform-browser-dynamic';
|
||||||
|
|
||||||
import { AppComponent } from './app.component';
|
import { AppComponent } from './app.component';
|
||||||
|
|
||||||
bootstrap(AppComponent, [])
|
bootstrap(AppComponent, []);
|
||||||
.catch((err: any) => console.error(err));
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// #docregion
|
// #docregion
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
import { DynamicFormComponent } from './dynamic-form.component';
|
|
||||||
import { QuestionService } from './question.service';
|
import { QuestionService } from './question.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -12,7 +11,6 @@ import { QuestionService } from './question.service';
|
||||||
<dynamic-form [questions]="questions"></dynamic-form>
|
<dynamic-form [questions]="questions"></dynamic-form>
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
directives: [DynamicFormComponent],
|
|
||||||
providers: [QuestionService]
|
providers: [QuestionService]
|
||||||
})
|
})
|
||||||
export class AppComponent {
|
export class AppComponent {
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
// #docregion
|
||||||
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
|
import { ReactiveFormsModule } from '@angular/forms';
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
|
||||||
|
import { AppComponent } from './app.component';
|
||||||
|
import { DynamicFormComponent } from './dynamic-form.component';
|
||||||
|
import { DynamicFormQuestionComponent } from './dynamic-form-question.component';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [ BrowserModule, ReactiveFormsModule ],
|
||||||
|
declarations: [ AppComponent, DynamicFormComponent, DynamicFormQuestionComponent ],
|
||||||
|
bootstrap: [ AppComponent ]
|
||||||
|
})
|
||||||
|
export class AppModule {
|
||||||
|
constructor() {
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,13 +1,12 @@
|
||||||
// #docregion
|
// #docregion
|
||||||
import { Component, Input } from '@angular/core';
|
import { Component, Input } from '@angular/core';
|
||||||
import { FormGroup, REACTIVE_FORM_DIRECTIVES } from '@angular/forms';
|
import { FormGroup } from '@angular/forms';
|
||||||
|
|
||||||
import { QuestionBase } from './question-base';
|
import { QuestionBase } from './question-base';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'df-question',
|
selector: 'df-question',
|
||||||
templateUrl: 'app/dynamic-form-question.component.html',
|
templateUrl: 'app/dynamic-form-question.component.html'
|
||||||
directives: [REACTIVE_FORM_DIRECTIVES]
|
|
||||||
})
|
})
|
||||||
export class DynamicFormQuestionComponent {
|
export class DynamicFormQuestionComponent {
|
||||||
@Input() question: QuestionBase<any>;
|
@Input() question: QuestionBase<any>;
|
||||||
|
|
|
@ -1,16 +1,14 @@
|
||||||
// #docregion
|
// #docregion
|
||||||
import { Component, Input, OnInit } from '@angular/core';
|
import { Component, Input, OnInit } from '@angular/core';
|
||||||
import { FormGroup, REACTIVE_FORM_DIRECTIVES } from '@angular/forms';
|
import { FormGroup } from '@angular/forms';
|
||||||
|
|
||||||
import { DynamicFormQuestionComponent } from './dynamic-form-question.component';
|
import { QuestionBase } from './question-base';
|
||||||
import { QuestionBase } from './question-base';
|
import { QuestionControlService } from './question-control.service';
|
||||||
import { QuestionControlService } from './question-control.service';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'dynamic-form',
|
selector: 'dynamic-form',
|
||||||
templateUrl: 'app/dynamic-form.component.html',
|
templateUrl: 'app/dynamic-form.component.html',
|
||||||
directives: [DynamicFormQuestionComponent, REACTIVE_FORM_DIRECTIVES],
|
providers: [ QuestionControlService ]
|
||||||
providers: [QuestionControlService]
|
|
||||||
})
|
})
|
||||||
export class DynamicFormComponent implements OnInit {
|
export class DynamicFormComponent implements OnInit {
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
// #docregion
|
// #docregion
|
||||||
import { bootstrap } from '@angular/platform-browser-dynamic';
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||||
import { disableDeprecatedForms, provideForms } from '@angular/forms';
|
import { AppModule } from './app.module';
|
||||||
|
|
||||||
import { AppComponent } from './app.component';
|
platformBrowserDynamic().bootstrapModule(AppModule);
|
||||||
|
|
||||||
bootstrap(AppComponent, [
|
|
||||||
disableDeprecatedForms(),
|
|
||||||
provideForms()
|
|
||||||
])
|
|
||||||
.catch((err: any) => console.error(err));
|
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
// #docregion
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { BrowserModule, Title } from '@angular/platform-browser';
|
||||||
|
|
||||||
|
import { AppComponent } from './app.component';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
BrowserModule
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
AppComponent
|
||||||
|
],
|
||||||
|
providers: [
|
||||||
|
Title
|
||||||
|
],
|
||||||
|
bootstrap: [ AppComponent ]
|
||||||
|
})
|
||||||
|
export class AppModule { }
|
|
@ -1,22 +1,6 @@
|
||||||
/* tslint:disable */
|
|
||||||
// #docregion
|
// #docregion
|
||||||
import { bootstrap } from '@angular/platform-browser-dynamic';
|
import { browserDynamicPlatform } from '@angular/platform-browser-dynamic';
|
||||||
|
|
||||||
import { AppComponent } from './app.component';
|
import { AppModule } from './app.module';
|
||||||
|
|
||||||
// While Angular supplies a Title service for setting the HTML document title
|
browserDynamicPlatform().bootstrapModule(AppModule);
|
||||||
// it doesn't include this service as part of the default Browser platform providers.
|
|
||||||
// As such, if we want to inject it into the components within our application,
|
|
||||||
// we have to explicitly provide the Angular service in our top component.
|
|
||||||
// #docregion bootstrap-title
|
|
||||||
import { Title } from '@angular/platform-browser';
|
|
||||||
|
|
||||||
bootstrap(AppComponent, [ Title ])
|
|
||||||
// #enddocregion bootstrap-title
|
|
||||||
.then(
|
|
||||||
() => window.console.info( 'Angular finished bootstrapping your application!' ),
|
|
||||||
(error) => {
|
|
||||||
console.warn( 'Angular was not able to bootstrap your application.' );
|
|
||||||
console.error( error );
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
|
@ -36,12 +36,22 @@
|
||||||
selector: 'hero-di-inject-additional',
|
selector: 'hero-di-inject-additional',
|
||||||
template: '<hero-title title="Tour of Heroes">' +
|
template: '<hero-title title="Tour of Heroes">' +
|
||||||
'<span #okMsg class="ok-msg"></span>' +
|
'<span #okMsg class="ok-msg"></span>' +
|
||||||
'</hero-title>',
|
'</hero-title>'
|
||||||
directives: [TitleComponent]
|
|
||||||
}).Class({
|
}).Class({
|
||||||
constructor: function() { }
|
constructor: function() { }
|
||||||
});
|
});
|
||||||
|
|
||||||
app.HeroDIInjectAdditionalComponent = AppComponent;
|
app.HeroesDIInjectAdditionalModule =
|
||||||
|
ng.core.NgModule({
|
||||||
|
imports: [ ng.platformBrowser.BrowserModule ],
|
||||||
|
declarations: [
|
||||||
|
AppComponent,
|
||||||
|
TitleComponent
|
||||||
|
],
|
||||||
|
bootstrap: [ AppComponent ]
|
||||||
|
})
|
||||||
|
.Class({
|
||||||
|
constructor: function() {}
|
||||||
|
});
|
||||||
|
|
||||||
})(window.app = window.app || {});
|
})(window.app = window.app || {});
|
||||||
|
|
|
@ -15,7 +15,16 @@
|
||||||
];
|
];
|
||||||
// #enddocregion parameters
|
// #enddocregion parameters
|
||||||
|
|
||||||
app.HeroDIInjectComponent = HeroComponent;
|
app.HeroesDIInjectModule =
|
||||||
|
ng.core.NgModule({
|
||||||
|
imports: [ ng.platformBrowser.BrowserModule ],
|
||||||
|
providers: [ { provide: 'heroName', useValue: 'Windstorm' } ],
|
||||||
|
declarations: [ HeroComponent ],
|
||||||
|
bootstrap: [ HeroComponent ]
|
||||||
|
})
|
||||||
|
.Class({
|
||||||
|
constructor: function() {}
|
||||||
|
});
|
||||||
|
|
||||||
})(window.app = window.app || {});
|
})(window.app = window.app || {});
|
||||||
|
|
||||||
|
@ -34,6 +43,15 @@
|
||||||
});
|
});
|
||||||
// #enddocregion ctor
|
// #enddocregion ctor
|
||||||
|
|
||||||
app.HeroDIInjectComponent2 = HeroComponent;
|
app.HeroesDIInjectModule2 =
|
||||||
|
ng.core.NgModule({
|
||||||
|
imports: [ ng.platformBrowser.BrowserModule ],
|
||||||
|
providers: [ { provide: 'heroName', useValue: 'Bombasto' } ],
|
||||||
|
declarations: [ HeroComponent ],
|
||||||
|
bootstrap: [ HeroComponent ]
|
||||||
|
})
|
||||||
|
.Class({
|
||||||
|
constructor: function() {}
|
||||||
|
});
|
||||||
|
|
||||||
})(window.app = window.app || {});
|
})(window.app = window.app || {});
|
||||||
|
|
|
@ -12,5 +12,16 @@
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
// #enddocregion
|
// #enddocregion
|
||||||
app.HeroDIInlineComponent = HeroComponent;
|
|
||||||
|
app.HeroDIInlineModule =
|
||||||
|
ng.core.NgModule({
|
||||||
|
imports: [ ng.platformBrowser.BrowserModule ],
|
||||||
|
providers: [ app.DataService ],
|
||||||
|
declarations: [ HeroComponent ],
|
||||||
|
bootstrap: [ HeroComponent ]
|
||||||
|
})
|
||||||
|
.Class({
|
||||||
|
constructor: function() {}
|
||||||
|
});
|
||||||
|
|
||||||
})(window.app = window.app || {});
|
})(window.app = window.app || {});
|
||||||
|
|
|
@ -17,4 +17,15 @@
|
||||||
];
|
];
|
||||||
// #enddocregion
|
// #enddocregion
|
||||||
|
|
||||||
|
app.HeroesDIModule =
|
||||||
|
ng.core.NgModule({
|
||||||
|
imports: [ ng.platformBrowser.BrowserModule ],
|
||||||
|
providers: [ app.DataService ],
|
||||||
|
declarations: [ HeroComponent ],
|
||||||
|
bootstrap: [ HeroComponent ]
|
||||||
|
})
|
||||||
|
.Class({
|
||||||
|
constructor: function() {}
|
||||||
|
});
|
||||||
|
|
||||||
})(window.app = window.app || {});
|
})(window.app = window.app || {});
|
||||||
|
|
|
@ -17,7 +17,15 @@
|
||||||
});
|
});
|
||||||
// #enddocregion component
|
// #enddocregion component
|
||||||
|
|
||||||
app.HeroComponentDsl = HeroComponent;
|
app.HeroesDslModule =
|
||||||
|
ng.core.NgModule({
|
||||||
|
imports: [ ng.platformBrowser.BrowserModule ],
|
||||||
|
declarations: [ HeroComponent ],
|
||||||
|
bootstrap: [ HeroComponent ]
|
||||||
|
})
|
||||||
|
.Class({
|
||||||
|
constructor: function() {}
|
||||||
|
});
|
||||||
|
|
||||||
})(window.app = window.app || {});
|
})(window.app = window.app || {});
|
||||||
// #enddocregion appexport
|
// #enddocregion appexport
|
||||||
|
|
|
@ -42,8 +42,7 @@
|
||||||
'(cancel)="onCancel()">' +
|
'(cancel)="onCancel()">' +
|
||||||
'</my-confirm>' +
|
'</my-confirm>' +
|
||||||
'<span *ngIf="okClicked">OK clicked</span>' +
|
'<span *ngIf="okClicked">OK clicked</span>' +
|
||||||
'<span *ngIf="cancelClicked">Cancel clicked</span>',
|
'<span *ngIf="cancelClicked">Cancel clicked</span>'
|
||||||
directives: [ConfirmComponent]
|
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
AppComponent.prototype.onOk = function() {
|
AppComponent.prototype.onOk = function() {
|
||||||
|
@ -52,6 +51,18 @@
|
||||||
AppComponent.prototype.onCancel = function() {
|
AppComponent.prototype.onCancel = function() {
|
||||||
this.cancelClicked = true;
|
this.cancelClicked = true;
|
||||||
}
|
}
|
||||||
app.HeroIOComponent = AppComponent;
|
|
||||||
|
app.HeroesIOModule =
|
||||||
|
ng.core.NgModule({
|
||||||
|
imports: [ ng.platformBrowser.BrowserModule ],
|
||||||
|
declarations: [
|
||||||
|
AppComponent,
|
||||||
|
ConfirmComponent
|
||||||
|
],
|
||||||
|
bootstrap: [ AppComponent ]
|
||||||
|
})
|
||||||
|
.Class({
|
||||||
|
constructor: function() {}
|
||||||
|
});
|
||||||
|
|
||||||
})(window.app = window.app || {});
|
})(window.app = window.app || {});
|
||||||
|
|
|
@ -16,6 +16,14 @@
|
||||||
};
|
};
|
||||||
// #enddocregion
|
// #enddocregion
|
||||||
|
|
||||||
app.HeroLifecycleComponent = HeroComponent;
|
app.HeroesLifecycleModule =
|
||||||
|
ng.core.NgModule({
|
||||||
|
imports: [ ng.platformBrowser.BrowserModule ],
|
||||||
|
declarations: [ HeroComponent ],
|
||||||
|
bootstrap: [ HeroComponent ]
|
||||||
|
})
|
||||||
|
.Class({
|
||||||
|
constructor: function() {}
|
||||||
|
});
|
||||||
|
|
||||||
})(window.app = window.app || {});
|
})(window.app = window.app || {});
|
||||||
|
|
|
@ -25,6 +25,16 @@
|
||||||
// #enddocregion constructorproto
|
// #enddocregion constructorproto
|
||||||
// #enddocregion metadata
|
// #enddocregion metadata
|
||||||
|
|
||||||
|
app.HeroesModule =
|
||||||
|
ng.core.NgModule({
|
||||||
|
imports: [ ng.platformBrowser.BrowserModule ],
|
||||||
|
declarations: [ HeroComponent ],
|
||||||
|
bootstrap: [ HeroComponent ]
|
||||||
|
})
|
||||||
|
.Class({
|
||||||
|
constructor: function() {}
|
||||||
|
});
|
||||||
|
|
||||||
// #docregion appexport
|
// #docregion appexport
|
||||||
app.HeroComponent = HeroComponent;
|
app.HeroComponent = HeroComponent;
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,15 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// #enddocregion
|
// #enddocregion
|
||||||
app.HeroesHostBindingsComponent = HeroesComponent;
|
|
||||||
|
app.HeroesHostBindingsModule =
|
||||||
|
ng.core.NgModule({
|
||||||
|
imports: [ ng.platformBrowser.BrowserModule ],
|
||||||
|
declarations: [ HeroesComponent ],
|
||||||
|
bootstrap: [ HeroesComponent ]
|
||||||
|
})
|
||||||
|
.Class({
|
||||||
|
constructor: function() {}
|
||||||
|
});
|
||||||
|
|
||||||
})(window.app = window.app || {});
|
})(window.app = window.app || {});
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
'Active' +
|
'Active' +
|
||||||
'</span>'
|
'</span>'
|
||||||
}).Class({
|
}).Class({
|
||||||
constructor: function() { },
|
constructor: [function() { }],
|
||||||
activate: function() {
|
activate: function() {
|
||||||
this.active = true;
|
this.active = true;
|
||||||
}
|
}
|
||||||
|
@ -26,12 +26,13 @@
|
||||||
ActiveLabelComponent)
|
ActiveLabelComponent)
|
||||||
}
|
}
|
||||||
}).Class({
|
}).Class({
|
||||||
constructor: function() { },
|
constructor: [function() { }],
|
||||||
activate: function() {
|
activate: function() {
|
||||||
this.active = true;
|
this.active = true;
|
||||||
this.label.activate();
|
this.label.activate();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
app.HeroQueriesComponent = HeroComponent;
|
||||||
// #enddocregion content
|
// #enddocregion content
|
||||||
|
|
||||||
// #docregion view
|
// #docregion view
|
||||||
|
@ -44,11 +45,7 @@
|
||||||
'</a-hero>' +
|
'</a-hero>' +
|
||||||
'<button (click)="activate()">' +
|
'<button (click)="activate()">' +
|
||||||
'Activate' +
|
'Activate' +
|
||||||
'</button>',
|
'</button>',
|
||||||
directives: [
|
|
||||||
HeroComponent,
|
|
||||||
ActiveLabelComponent
|
|
||||||
],
|
|
||||||
queries: {
|
queries: {
|
||||||
heroCmps: new ng.core.ViewChildren(
|
heroCmps: new ng.core.ViewChildren(
|
||||||
HeroComponent)
|
HeroComponent)
|
||||||
|
@ -68,6 +65,18 @@
|
||||||
});
|
});
|
||||||
// #enddocregion view
|
// #enddocregion view
|
||||||
|
|
||||||
app.HeroesQueriesComponent = AppComponent;
|
app.HeroesQueriesModule =
|
||||||
|
ng.core.NgModule({
|
||||||
|
imports: [ ng.platformBrowser.BrowserModule ],
|
||||||
|
declarations: [
|
||||||
|
AppComponent,
|
||||||
|
HeroComponent,
|
||||||
|
ActiveLabelComponent
|
||||||
|
],
|
||||||
|
bootstrap: [ AppComponent ]
|
||||||
|
})
|
||||||
|
.Class({
|
||||||
|
constructor: function() {}
|
||||||
|
});
|
||||||
|
|
||||||
})(window.app = window.app || {});
|
})(window.app = window.app || {});
|
||||||
|
|
|
@ -17,21 +17,20 @@
|
||||||
// #enddocregion appimport
|
// #enddocregion appimport
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
bootstrap(HeroComponent);
|
var platformBrowserDynamic = ng.platformBrowserDynamic.platformBrowserDynamic();
|
||||||
bootstrap(app.HeroComponentDsl);
|
|
||||||
bootstrap(app.HeroLifecycleComponent);
|
platformBrowserDynamic.bootstrapModule(app.HeroesModule);
|
||||||
bootstrap(app.HeroDIComponent, [app.DataService]);
|
platformBrowserDynamic.bootstrapModule(app.HeroesDslModule);
|
||||||
bootstrap(app.HeroDIInlineComponent, [app.DataService]);
|
platformBrowserDynamic.bootstrapModule(app.HeroesLifecycleModule);
|
||||||
bootstrap(app.HeroDIInjectComponent, [
|
platformBrowserDynamic.bootstrapModule(app.HeroesDIModule);
|
||||||
{ provide: 'heroName', useValue: 'Windstorm' }
|
platformBrowserDynamic.bootstrapModule(app.HeroDIInlineModule);
|
||||||
]);
|
platformBrowserDynamic.bootstrapModule(app.HeroesDIInjectModule);
|
||||||
bootstrap(app.HeroDIInjectComponent2, [
|
platformBrowserDynamic.bootstrapModule(app.HeroesDIInjectModule2);
|
||||||
{ provide: 'heroName', useValue: 'Bombasto' }
|
platformBrowserDynamic.bootstrapModule(app.HeroesDIInjectAdditionalModule);
|
||||||
]);
|
platformBrowserDynamic.bootstrapModule(app.HeroesIOModule);
|
||||||
bootstrap(app.HeroDIInjectAdditionalComponent);
|
platformBrowserDynamic.bootstrapModule(app.HeroesHostBindingsModule);
|
||||||
bootstrap(app.HeroIOComponent);
|
|
||||||
bootstrap(app.HeroesHostBindingsComponent);
|
platformBrowserDynamic.bootstrapModule(app.HeroesQueriesModule);
|
||||||
bootstrap(app.HeroesQueriesComponent);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// #docregion appimport
|
// #docregion appimport
|
||||||
|
|
|
@ -5,8 +5,10 @@ import {
|
||||||
Inject,
|
Inject,
|
||||||
Optional,
|
Optional,
|
||||||
Query,
|
Query,
|
||||||
QueryList
|
QueryList,
|
||||||
|
NgModule
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
|
|
||||||
// #docregion
|
// #docregion
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -17,7 +19,7 @@ import {
|
||||||
<ng-content></ng-content>
|
<ng-content></ng-content>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
export class TitleComponent {
|
class TitleComponent {
|
||||||
constructor(
|
constructor(
|
||||||
@Inject('titlePrefix')
|
@Inject('titlePrefix')
|
||||||
@Optional()
|
@Optional()
|
||||||
|
@ -40,9 +42,16 @@ export class TitleComponent {
|
||||||
selector: 'hero-di-inject-additional',
|
selector: 'hero-di-inject-additional',
|
||||||
template: `<hero-title title="Tour of Heroes">
|
template: `<hero-title title="Tour of Heroes">
|
||||||
<span #okMsg class="ok-msg"></span>
|
<span #okMsg class="ok-msg"></span>
|
||||||
</hero-title>`,
|
</hero-title>`
|
||||||
directives: [TitleComponent]
|
|
||||||
})
|
})
|
||||||
export class AppComponent {
|
class AppComponent { }
|
||||||
|
|
||||||
}
|
@NgModule({
|
||||||
|
imports: [ BrowserModule ],
|
||||||
|
declarations: [
|
||||||
|
AppComponent,
|
||||||
|
TitleComponent
|
||||||
|
],
|
||||||
|
bootstrap: [ AppComponent ]
|
||||||
|
})
|
||||||
|
export class HeroesDIInjectAdditionalModule { }
|
||||||
|
|
|
@ -1,14 +1,23 @@
|
||||||
import { Component, Inject } from '@angular/core';
|
import { Component, Inject, NgModule } from '@angular/core';
|
||||||
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
|
|
||||||
// #docregion
|
// #docregion
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'hero-di-inject',
|
selector: 'hero-di-inject',
|
||||||
template: `<h1>Hero: {{name}}</h1>`
|
template: `<h1>Hero: {{name}}</h1>`
|
||||||
})
|
})
|
||||||
export class HeroComponent {
|
class HeroComponent {
|
||||||
constructor(
|
constructor(
|
||||||
@Inject('heroName')
|
@Inject('heroName')
|
||||||
private name: string) {
|
private name: string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// #enddocregion
|
// #enddocregion
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [ BrowserModule ],
|
||||||
|
providers: [ { provide: 'heroName', useValue: 'Windstorm' } ],
|
||||||
|
declarations: [ HeroComponent ],
|
||||||
|
bootstrap: [ HeroComponent ]
|
||||||
|
})
|
||||||
|
export class HeroesDIInjectModule { }
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { Component } from '@angular/core';
|
import { Component, NgModule } from '@angular/core';
|
||||||
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
|
|
||||||
import { DataService } from './data.service';
|
import { DataService } from './data.service';
|
||||||
|
|
||||||
|
@ -7,10 +8,18 @@ import { DataService } from './data.service';
|
||||||
selector: 'hero-di',
|
selector: 'hero-di',
|
||||||
template: `<h1>Hero: {{name}}</h1>`
|
template: `<h1>Hero: {{name}}</h1>`
|
||||||
})
|
})
|
||||||
export class HeroComponent {
|
class HeroComponent {
|
||||||
name: string;
|
name: string;
|
||||||
constructor(dataService: DataService) {
|
constructor(dataService: DataService) {
|
||||||
this.name = dataService.getHeroName();
|
this.name = dataService.getHeroName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// #enddocregion
|
// #enddocregion
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [ BrowserModule ],
|
||||||
|
providers: [ DataService ],
|
||||||
|
declarations: [ HeroComponent ],
|
||||||
|
bootstrap: [ HeroComponent ]
|
||||||
|
})
|
||||||
|
export class HeroesDIModule { }
|
||||||
|
|
|
@ -1,4 +1,11 @@
|
||||||
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
import {
|
||||||
|
Component,
|
||||||
|
EventEmitter,
|
||||||
|
Input,
|
||||||
|
Output,
|
||||||
|
NgModule
|
||||||
|
} from '@angular/core';
|
||||||
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
|
|
||||||
// #docregion
|
// #docregion
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -12,7 +19,7 @@ import { Component, EventEmitter, Input, Output } from '@angular/core';
|
||||||
</button>
|
</button>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
export class ConfirmComponent {
|
class ConfirmComponent {
|
||||||
@Input() okMsg: string;
|
@Input() okMsg: string;
|
||||||
@Input('cancelMsg') notOkMsg: string;
|
@Input('cancelMsg') notOkMsg: string;
|
||||||
@Output() ok =
|
@Output() ok =
|
||||||
|
@ -40,10 +47,9 @@ export class ConfirmComponent {
|
||||||
</my-confirm>
|
</my-confirm>
|
||||||
<span *ngIf="okClicked">OK clicked</span>
|
<span *ngIf="okClicked">OK clicked</span>
|
||||||
<span *ngIf="cancelClicked">Cancel clicked</span>
|
<span *ngIf="cancelClicked">Cancel clicked</span>
|
||||||
`,
|
`
|
||||||
directives: [ConfirmComponent]
|
|
||||||
})
|
})
|
||||||
export class AppComponent {
|
class AppComponent {
|
||||||
okClicked: boolean;
|
okClicked: boolean;
|
||||||
cancelClicked: boolean;
|
cancelClicked: boolean;
|
||||||
|
|
||||||
|
@ -54,3 +60,14 @@ export class AppComponent {
|
||||||
this.cancelClicked = true;
|
this.cancelClicked = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [ BrowserModule ],
|
||||||
|
declarations: [
|
||||||
|
AppComponent,
|
||||||
|
ConfirmComponent
|
||||||
|
],
|
||||||
|
bootstrap: [ AppComponent ]
|
||||||
|
})
|
||||||
|
export class HeroesIOModule { }
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
// #docplaster
|
// #docplaster
|
||||||
// #docregion
|
// #docregion
|
||||||
import { Component, OnInit }
|
import { Component, OnInit } from '@angular/core';
|
||||||
from '@angular/core';
|
// #enddocregion
|
||||||
// #enddocregion
|
import { NgModule } from '@angular/core';
|
||||||
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'hero-lifecycle',
|
selector: 'hero-lifecycle',
|
||||||
template: `<h1>Hero: {{name}}</h1>`
|
template: `<h1>Hero: {{name}}</h1>`
|
||||||
})
|
})
|
||||||
// #docregion
|
// #docregion
|
||||||
export class HeroComponent
|
class HeroComponent
|
||||||
implements OnInit {
|
implements OnInit {
|
||||||
name: string;
|
name: string;
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
@ -17,3 +18,11 @@ export class HeroComponent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// #enddocregion
|
// #enddocregion
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [ BrowserModule ],
|
||||||
|
declarations: [ HeroComponent ],
|
||||||
|
bootstrap: [ HeroComponent ]
|
||||||
|
})
|
||||||
|
export class HeroesLifecycleModule { }
|
||||||
|
|
||||||
|
|
|
@ -16,3 +16,15 @@ export class HeroComponent {
|
||||||
// #enddocregion class
|
// #enddocregion class
|
||||||
// #enddocregion appexport
|
// #enddocregion appexport
|
||||||
// #enddocregion metadata
|
// #enddocregion metadata
|
||||||
|
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [ BrowserModule ],
|
||||||
|
declarations: [ HeroComponent ],
|
||||||
|
bootstrap: [ HeroComponent ]
|
||||||
|
})
|
||||||
|
export class HeroesModule { }
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,19 @@
|
||||||
import { Component, HostBinding, HostListener } from '@angular/core';
|
import {
|
||||||
|
Component,
|
||||||
|
HostBinding,
|
||||||
|
HostListener,
|
||||||
|
NgModule
|
||||||
|
} from '@angular/core';
|
||||||
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
|
|
||||||
// #docregion
|
// #docregion
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'heroes-bindings',
|
selector: 'heroes-bindings',
|
||||||
template: `<h1 [class.active]="active">
|
template: `<h1 [class.active]="active">
|
||||||
Tour ofHeroes
|
Tour of Heroes
|
||||||
</h1>`
|
</h1>`
|
||||||
})
|
})
|
||||||
export class HeroesComponent {
|
class HeroesComponent {
|
||||||
@HostBinding() title = 'Tooltip content';
|
@HostBinding() title = 'Tooltip content';
|
||||||
@HostBinding('class.heading')
|
@HostBinding('class.heading')
|
||||||
hClass = true;
|
hClass = true;
|
||||||
|
@ -26,3 +32,10 @@ export class HeroesComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// #enddocregion
|
// #enddocregion
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [ BrowserModule ],
|
||||||
|
declarations: [ HeroesComponent ],
|
||||||
|
bootstrap: [ HeroesComponent ]
|
||||||
|
})
|
||||||
|
export class HeroesHostBindingsModule { }
|
||||||
|
|
|
@ -3,8 +3,10 @@ import {
|
||||||
ViewChildren,
|
ViewChildren,
|
||||||
ContentChild,
|
ContentChild,
|
||||||
QueryList,
|
QueryList,
|
||||||
Input
|
Input,
|
||||||
|
NgModule
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'active-label',
|
selector: 'active-label',
|
||||||
|
@ -55,13 +57,9 @@ class HeroComponent {
|
||||||
<button (click)="activate()">
|
<button (click)="activate()">
|
||||||
Activate
|
Activate
|
||||||
</button>
|
</button>
|
||||||
`,
|
`
|
||||||
directives: [
|
|
||||||
HeroComponent,
|
|
||||||
ActiveLabelComponent
|
|
||||||
]
|
|
||||||
})
|
})
|
||||||
export class HeroesQueriesComponent {
|
class HeroesQueriesComponent {
|
||||||
heroData = [
|
heroData = [
|
||||||
{id: 1, name: 'Windstorm'},
|
{id: 1, name: 'Windstorm'},
|
||||||
{id: 2, name: 'Superman'}
|
{id: 2, name: 'Superman'}
|
||||||
|
@ -77,3 +75,14 @@ export class HeroesQueriesComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// #enddocregion view
|
// #enddocregion view
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [ BrowserModule ],
|
||||||
|
declarations: [
|
||||||
|
HeroesQueriesComponent,
|
||||||
|
HeroComponent,
|
||||||
|
ActiveLabelComponent
|
||||||
|
],
|
||||||
|
bootstrap: [ HeroesQueriesComponent ]
|
||||||
|
})
|
||||||
|
export class HeroesQueriesModule { }
|
||||||
|
|
|
@ -9,26 +9,25 @@ import {
|
||||||
// #enddocregion ng2import
|
// #enddocregion ng2import
|
||||||
|
|
||||||
// #docregion appimport
|
// #docregion appimport
|
||||||
import { HeroComponent }
|
import { HeroComponent } from './hero.component';
|
||||||
from './hero.component';
|
|
||||||
// #enddocregion appimport
|
// #enddocregion appimport
|
||||||
import { HeroComponent as HeroLifecycleComponent } from './hero-lifecycle.component';
|
|
||||||
import { HeroComponent as HeroDIComponent } from './hero-di.component';
|
|
||||||
import { HeroComponent as HeroDIInjectComponent } from './hero-di-inject.component';
|
|
||||||
import { AppComponent as AppDIInjectAdditionalComponent } from './hero-di-inject-additional.component';
|
|
||||||
import { AppComponent as AppIOComponent } from './hero-io.component';
|
|
||||||
import { HeroesComponent as HeroesHostBindingsComponent } from './heroes-bindings.component';
|
|
||||||
import { HeroesQueriesComponent } from './heroes-queries.component';
|
|
||||||
|
|
||||||
import { DataService } from './data.service';
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||||
|
|
||||||
bootstrap(HeroComponent);
|
import { HeroesModule } from './hero.component';
|
||||||
bootstrap(HeroLifecycleComponent);
|
import { HeroesLifecycleModule } from './hero-lifecycle.component';
|
||||||
bootstrap(HeroDIComponent, [DataService]);
|
import { HeroesDIModule } from './hero-di.component';
|
||||||
bootstrap(HeroDIInjectComponent, [
|
import { HeroesDIInjectModule } from './hero-di-inject.component';
|
||||||
{ provide: 'heroName', useValue: 'Windstorm' }
|
import { HeroesDIInjectAdditionalModule } from './hero-di-inject-additional.component';
|
||||||
]);
|
import { HeroesIOModule } from './hero-io.component';
|
||||||
bootstrap(AppDIInjectAdditionalComponent);
|
import { HeroesHostBindingsModule } from './heroes-bindings.component';
|
||||||
bootstrap(AppIOComponent);
|
import { HeroesQueriesModule } from './heroes-queries.component';
|
||||||
bootstrap(HeroesHostBindingsComponent);
|
|
||||||
bootstrap(HeroesQueriesComponent);
|
platformBrowserDynamic().bootstrapModule(HeroesModule);
|
||||||
|
platformBrowserDynamic().bootstrapModule(HeroesLifecycleModule);
|
||||||
|
platformBrowserDynamic().bootstrapModule(HeroesDIModule);
|
||||||
|
platformBrowserDynamic().bootstrapModule(HeroesDIInjectModule);
|
||||||
|
platformBrowserDynamic().bootstrapModule(HeroesDIInjectAdditionalModule);
|
||||||
|
platformBrowserDynamic().bootstrapModule(HeroesIOModule);
|
||||||
|
platformBrowserDynamic().bootstrapModule(HeroesHostBindingsModule);
|
||||||
|
platformBrowserDynamic().bootstrapModule(HeroesQueriesModule);
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
|
|
||||||
|
import { HeroAppComponent } from './hero-app.component';
|
||||||
|
import { HeroAppMainComponent } from './hero-app-main.component';
|
||||||
|
import { HeroDetailsComponent } from './hero-details.component';
|
||||||
|
import { HeroControlsComponent } from './hero-controls.component';
|
||||||
|
import { QuestSummaryComponent } from './quest-summary.component';
|
||||||
|
import { HeroTeamComponent } from './hero-team.component';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [ BrowserModule ],
|
||||||
|
declarations: [
|
||||||
|
HeroAppComponent,
|
||||||
|
HeroAppMainComponent,
|
||||||
|
HeroDetailsComponent,
|
||||||
|
HeroControlsComponent,
|
||||||
|
QuestSummaryComponent,
|
||||||
|
HeroTeamComponent
|
||||||
|
],
|
||||||
|
bootstrap: [ HeroAppComponent ]
|
||||||
|
})
|
||||||
|
export class AppModule { }
|
|
@ -1,9 +1,6 @@
|
||||||
import { Component, Input } from '@angular/core';
|
import { Component, Input } from '@angular/core';
|
||||||
|
|
||||||
import { Hero } from './hero';
|
import { Hero } from './hero';
|
||||||
import { HeroDetailsComponent } from './hero-details.component';
|
|
||||||
import { HeroControlsComponent } from './hero-controls.component';
|
|
||||||
import { QuestSummaryComponent } from './quest-summary.component';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'hero-app-main',
|
selector: 'hero-app-main',
|
||||||
|
@ -12,8 +9,7 @@ import { QuestSummaryComponent } from './quest-summary.component';
|
||||||
<hero-details [hero]=hero [class.active]=hero.active>
|
<hero-details [hero]=hero [class.active]=hero.active>
|
||||||
<hero-controls [hero]=hero></hero-controls>
|
<hero-controls [hero]=hero></hero-controls>
|
||||||
</hero-details>
|
</hero-details>
|
||||||
`,
|
`
|
||||||
directives: [HeroDetailsComponent, HeroControlsComponent, QuestSummaryComponent]
|
|
||||||
})
|
})
|
||||||
export class HeroAppMainComponent {
|
export class HeroAppMainComponent {
|
||||||
@Input() hero: Hero;
|
@Input() hero: Hero;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import { Component, HostBinding } from '@angular/core';
|
import { Component, HostBinding } from '@angular/core';
|
||||||
import { Hero } from './hero';
|
import { Hero } from './hero';
|
||||||
import { HeroAppMainComponent } from './hero-app-main.component';
|
|
||||||
|
|
||||||
// #docregion
|
// #docregion
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -8,8 +7,7 @@ import { HeroAppMainComponent } from './hero-app-main.component';
|
||||||
template: `
|
template: `
|
||||||
<h1>Tour of Heroes</h1>
|
<h1>Tour of Heroes</h1>
|
||||||
<hero-app-main [hero]=hero></hero-app-main>`,
|
<hero-app-main [hero]=hero></hero-app-main>`,
|
||||||
styles: ['h1 { font-weight: normal; }'],
|
styles: ['h1 { font-weight: normal; }']
|
||||||
directives: [HeroAppMainComponent]
|
|
||||||
})
|
})
|
||||||
export class HeroAppComponent {
|
export class HeroAppComponent {
|
||||||
// #enddocregion
|
// #enddocregion
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import { Component, Input } from '@angular/core';
|
import { Component, Input } from '@angular/core';
|
||||||
import { Hero } from './hero';
|
import { Hero } from './hero';
|
||||||
import { HeroTeamComponent } from './hero-team.component';
|
|
||||||
|
|
||||||
// #docregion styleurls
|
// #docregion styleurls
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -10,8 +9,7 @@ import { HeroTeamComponent } from './hero-team.component';
|
||||||
<hero-team [hero]=hero></hero-team>
|
<hero-team [hero]=hero></hero-team>
|
||||||
<ng-content></ng-content>
|
<ng-content></ng-content>
|
||||||
`,
|
`,
|
||||||
styleUrls: ['app/hero-details.component.css'],
|
styleUrls: ['app/hero-details.component.css']
|
||||||
directives: [HeroTeamComponent]
|
|
||||||
})
|
})
|
||||||
export class HeroDetailsComponent {
|
export class HeroDetailsComponent {
|
||||||
// #enddocregion styleurls
|
// #enddocregion styleurls
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { bootstrap } from '@angular/platform-browser-dynamic';
|
// #docregion
|
||||||
import { HeroAppComponent } from './hero-app.component';
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||||
|
import { AppModule } from './app.module';
|
||||||
|
|
||||||
bootstrap(HeroAppComponent);
|
platformBrowserDynamic().bootstrapModule(AppModule);
|
||||||
|
|
|
@ -3,17 +3,13 @@
|
||||||
// #docregion
|
// #docregion
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
import { CarComponent } from './car/car.component';
|
|
||||||
import { HeroesComponent } from './heroes/heroes.component.1';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-app',
|
selector: 'my-app',
|
||||||
template: `
|
template: `
|
||||||
<h1>{{title}}</h1>
|
<h1>{{title}}</h1>
|
||||||
<my-car></my-car>
|
<my-car></my-car>
|
||||||
<my-heroes></my-heroes>
|
<my-heroes></my-heroes>
|
||||||
`,
|
`
|
||||||
directives: [CarComponent, HeroesComponent]
|
|
||||||
})
|
})
|
||||||
|
|
||||||
export class AppComponent {
|
export class AppComponent {
|
||||||
|
|
|
@ -1,13 +1,9 @@
|
||||||
// #docregion
|
// #docregion
|
||||||
// #docregion imports
|
// #docregion imports
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { CarComponent } from './car/car.component';
|
|
||||||
import { HeroesComponent } from './heroes/heroes.component.1';
|
|
||||||
|
|
||||||
import { Inject } from '@angular/core';
|
import { Inject } from '@angular/core';
|
||||||
import { APP_CONFIG, AppConfig,
|
|
||||||
HERO_DI_CONFIG } from './app.config';
|
import { APP_CONFIG, AppConfig } from './app.config';
|
||||||
import { Logger } from './logger.service';
|
|
||||||
// #enddocregion imports
|
// #enddocregion imports
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -16,14 +12,7 @@ import { Logger } from './logger.service';
|
||||||
<h1>{{title}}</h1>
|
<h1>{{title}}</h1>
|
||||||
<my-car></my-car>
|
<my-car></my-car>
|
||||||
<my-heroes></my-heroes>
|
<my-heroes></my-heroes>
|
||||||
`,
|
`
|
||||||
directives: [CarComponent, HeroesComponent],
|
|
||||||
providers: [
|
|
||||||
Logger,
|
|
||||||
// #docregion providers
|
|
||||||
{ provide: APP_CONFIG, useValue: HERO_DI_CONFIG }
|
|
||||||
// #enddocregion providers
|
|
||||||
]
|
|
||||||
})
|
})
|
||||||
export class AppComponent {
|
export class AppComponent {
|
||||||
title: string;
|
title: string;
|
||||||
|
|
|
@ -3,18 +3,10 @@
|
||||||
// #docregion imports
|
// #docregion imports
|
||||||
import { Component, Inject } from '@angular/core';
|
import { Component, Inject } from '@angular/core';
|
||||||
|
|
||||||
import { CarComponent } from './car/car.component';
|
import { APP_CONFIG, AppConfig } from './app.config';
|
||||||
import { HeroesComponent } from './heroes/heroes.component';
|
import { Logger } from './logger.service';
|
||||||
|
|
||||||
import { APP_CONFIG, AppConfig,
|
|
||||||
HERO_DI_CONFIG } from './app.config';
|
|
||||||
import { Logger } from './logger.service';
|
|
||||||
|
|
||||||
import { UserService } from './user.service';
|
import { UserService } from './user.service';
|
||||||
// #enddocregion imports
|
// #enddocregion imports
|
||||||
import { InjectorComponent } from './injector.component';
|
|
||||||
import { TestComponent } from './test.component';
|
|
||||||
import { ProvidersComponent } from './providers.component';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-app',
|
selector: 'my-app',
|
||||||
|
@ -31,15 +23,7 @@ import { ProvidersComponent } from './providers.component';
|
||||||
<my-heroes id="authorized" *ngIf="isAuthorized"></my-heroes>
|
<my-heroes id="authorized" *ngIf="isAuthorized"></my-heroes>
|
||||||
<my-heroes id="unauthorized" *ngIf="!isAuthorized"></my-heroes>
|
<my-heroes id="unauthorized" *ngIf="!isAuthorized"></my-heroes>
|
||||||
`,
|
`,
|
||||||
directives: [CarComponent, HeroesComponent,
|
providers: [Logger]
|
||||||
InjectorComponent, TestComponent, ProvidersComponent],
|
|
||||||
// #docregion providers
|
|
||||||
providers: [
|
|
||||||
Logger,
|
|
||||||
UserService,
|
|
||||||
{ provide: APP_CONFIG, useValue: HERO_DI_CONFIG }
|
|
||||||
]
|
|
||||||
// #enddocregion providers
|
|
||||||
})
|
})
|
||||||
export class AppComponent {
|
export class AppComponent {
|
||||||
title: string;
|
title: string;
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
|
|
||||||
|
import { AppComponent } from './app.component';
|
||||||
|
import { CarComponent } from './car/car.component';
|
||||||
|
import { HeroesComponent } from './heroes/heroes.component';
|
||||||
|
import { HeroListComponent } from './heroes/hero-list.component';
|
||||||
|
import { InjectorComponent } from './injector.component';
|
||||||
|
import { TestComponent } from './test.component';
|
||||||
|
import { ProvidersComponent } from './providers.component';
|
||||||
|
import { APP_CONFIG, HERO_DI_CONFIG } from './app.config';
|
||||||
|
import { UserService } from './user.service';
|
||||||
|
|
||||||
|
// #docregion ngmodule
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
BrowserModule
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
AppComponent,
|
||||||
|
CarComponent,
|
||||||
|
HeroesComponent,
|
||||||
|
HeroListComponent,
|
||||||
|
InjectorComponent,
|
||||||
|
TestComponent
|
||||||
|
],
|
||||||
|
// #docregion ngmodule-providers
|
||||||
|
providers: [
|
||||||
|
UserService,
|
||||||
|
{ provide: APP_CONFIG, useValue: HERO_DI_CONFIG }
|
||||||
|
],
|
||||||
|
// #enddocregion ngmodule-providers
|
||||||
|
bootstrap: [ AppComponent, ProvidersComponent ]
|
||||||
|
})
|
||||||
|
export class AppModule { }
|
||||||
|
// #enddocregion ngmodule
|
|
@ -18,7 +18,7 @@ import { HeroService } from './hero.service';
|
||||||
<div *ngFor="let hero of heroes">
|
<div *ngFor="let hero of heroes">
|
||||||
{{hero.id}} - {{hero.name}}
|
{{hero.id}} - {{hero.name}}
|
||||||
</div>
|
</div>
|
||||||
`,
|
`
|
||||||
})
|
})
|
||||||
export class HeroListComponent {
|
export class HeroListComponent {
|
||||||
heroes: Hero[];
|
heroes: Hero[];
|
||||||
|
|
|
@ -1,28 +1,21 @@
|
||||||
// #docplaster
|
// #docplaster
|
||||||
// #docregion full, v1
|
// #docregion full, v1
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
// #enddocregion full, v1
|
|
||||||
import { HeroListComponent } from './hero-list.component.2';
|
|
||||||
import { HeroService } from './hero.service.1';
|
|
||||||
/*
|
|
||||||
// #docregion full, v1
|
|
||||||
import { HeroListComponent } from './hero-list.component';
|
|
||||||
// #enddocregion v1
|
// #enddocregion v1
|
||||||
|
|
||||||
import { HeroService } from './hero.service';
|
import { HeroService } from './hero.service';
|
||||||
// #enddocregion full
|
// #enddocregion full
|
||||||
*/
|
|
||||||
// #docregion full, v1
|
// #docregion full, v1
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-heroes',
|
selector: 'my-heroes',
|
||||||
|
// #enddocregion v1
|
||||||
|
providers: [HeroService],
|
||||||
|
// #docregion v1
|
||||||
template: `
|
template: `
|
||||||
<h2>Heroes</h2>
|
<h2>Heroes</h2>
|
||||||
<hero-list></hero-list>
|
<hero-list></hero-list>
|
||||||
`,
|
`
|
||||||
// #enddocregion v1
|
|
||||||
providers: [HeroService],
|
|
||||||
// #docregion v1
|
|
||||||
directives: [HeroListComponent]
|
|
||||||
})
|
})
|
||||||
export class HeroesComponent { }
|
export class HeroesComponent { }
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// #docregion
|
// #docregion
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
import { HeroListComponent } from './hero-list.component';
|
|
||||||
import { heroServiceProvider } from './hero.service.provider';
|
import { heroServiceProvider } from './hero.service.provider';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -10,7 +9,6 @@ import { heroServiceProvider } from './hero.service.provider';
|
||||||
<h2>Heroes</h2>
|
<h2>Heroes</h2>
|
||||||
<hero-list></hero-list>
|
<hero-list></hero-list>
|
||||||
`,
|
`,
|
||||||
providers: [heroServiceProvider],
|
providers: [heroServiceProvider]
|
||||||
directives: [HeroListComponent]
|
|
||||||
})
|
})
|
||||||
export class HeroesComponent { }
|
export class HeroesComponent { }
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
/* tslint:disable:no-unused-variable */
|
|
||||||
import { bootstrap } from '@angular/platform-browser-dynamic';
|
|
||||||
import { AppComponent } from './app.component.1';
|
|
||||||
import { HeroService } from './heroes/hero.service.1';
|
|
||||||
|
|
||||||
bootstrap(AppComponent);
|
|
||||||
|
|
||||||
function discouraged() {
|
|
||||||
// #docregion bootstrap-discouraged
|
|
||||||
bootstrap(AppComponent,
|
|
||||||
[HeroService]); // DISCOURAGED (but works)
|
|
||||||
// #enddocregion bootstrap-discouraged
|
|
||||||
}
|
|
|
@ -1,8 +1,6 @@
|
||||||
import { bootstrap } from '@angular/platform-browser-dynamic';
|
import { browserDynamicPlatform } from '@angular/platform-browser-dynamic';
|
||||||
import { AppComponent } from './app.component';
|
import { AppModule } from './app.module';
|
||||||
import { ProvidersComponent } from './providers.component';
|
|
||||||
|
|
||||||
// #docregion bootstrap
|
// #docregion bootstrap
|
||||||
bootstrap(AppComponent);
|
browserDynamicPlatform().bootstrapModule(AppModule);
|
||||||
// #enddocregion bootstrap
|
// #enddocregion bootstrap
|
||||||
bootstrap(ProvidersComponent);
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// #docregion
|
// #docregion
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
// #docregion import
|
// #docregion import
|
||||||
import { Hero } from './hero';
|
import { Hero } from './hero';
|
||||||
// #enddocregion import
|
// #enddocregion import
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// #docplaster
|
// #docplaster
|
||||||
// #docregion final
|
// #docregion final
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
import { Hero } from './hero';
|
import { Hero } from './hero';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
// #docregion
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
|
|
||||||
|
import { AppComponent } from './app.component';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
BrowserModule
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
AppComponent
|
||||||
|
],
|
||||||
|
bootstrap: [ AppComponent ]
|
||||||
|
})
|
||||||
|
export class AppModule { }
|
|
@ -1,6 +1,6 @@
|
||||||
// #docregion
|
// #docregion
|
||||||
import { bootstrap } from '@angular/platform-browser-dynamic';
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||||
|
|
||||||
import { AppComponent } from './app.component';
|
import { AppModule } from './app.module';
|
||||||
|
|
||||||
bootstrap(AppComponent);
|
platformBrowserDynamic().bootstrapModule(AppModule);
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
app.AppComponent = ng.core
|
app.AppComponent = ng.core
|
||||||
.Component({
|
.Component({
|
||||||
selector: 'my-app',
|
selector: 'my-app',
|
||||||
template: '<hero-form></hero-form>',
|
template: '<hero-form></hero-form>'
|
||||||
directives: [app.HeroFormComponent]
|
|
||||||
})
|
})
|
||||||
.Class({
|
.Class({
|
||||||
constructor: function() {}
|
constructor: function() {}
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
// #docplaster
|
||||||
|
// #docregion
|
||||||
|
(function(app) {
|
||||||
|
app.AppModule =
|
||||||
|
ng.core.NgModule({
|
||||||
|
imports: [
|
||||||
|
ng.platformBrowser.BrowserModule,
|
||||||
|
ng.forms.FormsModule
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
app.AppComponent,
|
||||||
|
app.HeroFormComponent
|
||||||
|
],
|
||||||
|
bootstrap: [ app.AppComponent ]
|
||||||
|
})
|
||||||
|
.Class({
|
||||||
|
constructor: function() {}
|
||||||
|
});
|
||||||
|
})(window.app || (window.app = {}));
|
|
@ -9,7 +9,7 @@
|
||||||
})
|
})
|
||||||
.Class({
|
.Class({
|
||||||
// #docregion submitted
|
// #docregion submitted
|
||||||
constructor: function() {
|
constructor: [function() {
|
||||||
// #enddocregion submitted
|
// #enddocregion submitted
|
||||||
this.powers = ['Really Smart', 'Super Flexible',
|
this.powers = ['Really Smart', 'Super Flexible',
|
||||||
'Super Hot', 'Weather Changer'
|
'Super Hot', 'Weather Changer'
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
// #docregion submitted
|
// #docregion submitted
|
||||||
this.submitted = false;
|
this.submitted = false;
|
||||||
},
|
}],
|
||||||
onSubmit: function() {
|
onSubmit: function() {
|
||||||
this.submitted = true;
|
this.submitted = true;
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
// #docregion
|
// #docregion
|
||||||
(function(app) {
|
(function(app) {
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
ng.platformBrowserDynamic.bootstrap(app.AppComponent,[
|
ng.platformBrowserDynamic
|
||||||
ng.forms.disableDeprecatedForms(),
|
.platformBrowserDynamic()
|
||||||
ng.forms.provideForms()
|
.bootstrapModule(app.AppModule);
|
||||||
]);
|
|
||||||
});
|
});
|
||||||
})(window.app || (window.app = {}));
|
})(window.app || (window.app = {}));
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
<!-- #enddocregion scripts-hero-form -->
|
<!-- #enddocregion scripts-hero-form -->
|
||||||
<!-- #docregion scripts, scripts-hero, scripts-hero-form -->
|
<!-- #docregion scripts, scripts-hero, scripts-hero-form -->
|
||||||
<script src='app/app.component.js'></script>
|
<script src='app/app.component.js'></script>
|
||||||
|
<script src='app/app.module.js'></script>
|
||||||
<script src='app/main.js'></script>
|
<script src='app/main.js'></script>
|
||||||
<!-- #enddocregion scripts, scripts-hero, scripts-hero-form -->
|
<!-- #enddocregion scripts, scripts-hero, scripts-hero-form -->
|
||||||
</head>
|
</head>
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
// #docregion
|
// #docregion
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { HeroFormComponent } from './hero-form.component';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-app',
|
selector: 'my-app',
|
||||||
template: '<hero-form></hero-form>',
|
template: '<hero-form></hero-form>'
|
||||||
directives: [HeroFormComponent]
|
|
||||||
})
|
})
|
||||||
export class AppComponent { }
|
export class AppComponent { }
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
// #docregion
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
|
import { FormsModule } from '@angular/forms';
|
||||||
|
|
||||||
|
import { AppComponent } from './app.component';
|
||||||
|
import { HeroFormComponent } from './hero-form.component';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
BrowserModule,
|
||||||
|
FormsModule
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
AppComponent,
|
||||||
|
HeroFormComponent
|
||||||
|
],
|
||||||
|
bootstrap: [ AppComponent ]
|
||||||
|
})
|
||||||
|
export class AppModule { }
|
|
@ -11,11 +11,13 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<!-- #docregion name-with-error-msg -->
|
<!-- #docregion name-with-error-msg -->
|
||||||
<label for="name">Name</label>
|
<label for="name">Name</label>
|
||||||
<input type="text" class="form-control" required
|
<input type="text" class="form-control" id="name"
|
||||||
[(ngModel)]="model.name"
|
required
|
||||||
name="name" #name="ngModel" >
|
[(ngModel)]="model.name" name="name"
|
||||||
|
#name="ngModel" >
|
||||||
<!-- #docregion hidden-error-msg -->
|
<!-- #docregion hidden-error-msg -->
|
||||||
<div [hidden]="name.valid || name.pristine" class="alert alert-danger">
|
<div [hidden]="name.valid || name.pristine"
|
||||||
|
class="alert alert-danger">
|
||||||
<!-- #enddocregion hidden-error-msg -->
|
<!-- #enddocregion hidden-error-msg -->
|
||||||
Name is required
|
Name is required
|
||||||
</div>
|
</div>
|
||||||
|
@ -24,16 +26,16 @@
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="alterEgo">Alter Ego</label>
|
<label for="alterEgo">Alter Ego</label>
|
||||||
<input type="text" class="form-control"
|
<input type="text" class="form-control" id="alterEgo"
|
||||||
[(ngModel)]="model.alterEgo"
|
[(ngModel)]="model.alterEgo" name="alterEgo" >
|
||||||
name="alterEgo" >
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="power">Hero Power</label>
|
<label for="power">Hero Power</label>
|
||||||
<select class="form-control" required
|
<select class="form-control" id="power"
|
||||||
[(ngModel)]="model.power"
|
required
|
||||||
name="power" #power="ngModel" >
|
[(ngModel)]="model.power" name="power"
|
||||||
|
#power="ngModel" >
|
||||||
<option *ngFor="let p of powers" [value]="p">{{p}}</option>
|
<option *ngFor="let p of powers" [value]="p">{{p}}</option>
|
||||||
</select>
|
</select>
|
||||||
<div [hidden]="power.valid || power.pristine" class="alert alert-danger">
|
<div [hidden]="power.valid || power.pristine" class="alert alert-danger">
|
||||||
|
@ -111,19 +113,19 @@
|
||||||
<form>
|
<form>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="name">Name</label>
|
<label for="name">Name</label>
|
||||||
<input type="text" class="form-control" required>
|
<input type="text" class="form-control" id="name" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="alterEgo">Alter Ego</label>
|
<label for="alterEgo">Alter Ego</label>
|
||||||
<input type="text" class="form-control">
|
<input type="text" class="form-control" id="alterEgo">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- #enddocregion start -->
|
<!-- #enddocregion start -->
|
||||||
<!-- #docregion powers -->
|
<!-- #docregion powers -->
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="power">Hero Power</label>
|
<label for="power">Hero Power</label>
|
||||||
<select class="form-control" required>
|
<select class="form-control" id="power" required>
|
||||||
<option *ngFor="let p of powers" [value]="p">{{p}}</option>
|
<option *ngFor="let p of powers" [value]="p">{{p}}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
@ -147,20 +149,22 @@
|
||||||
{{diagnostic}}
|
{{diagnostic}}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="name">Name</label>
|
<label for="name">Name</label>
|
||||||
<input type="text" class="form-control" required
|
<input type="text" class="form-control" id="name"
|
||||||
[(ngModel)]="model.name" name="name">
|
required
|
||||||
|
[(ngModel)]="model.name" name="name">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="alterEgo">Alter Ego</label>
|
<label for="alterEgo">Alter Ego</label>
|
||||||
<input type="text" class="form-control"
|
<input type="text" class="form-control" id="alterEgo"
|
||||||
[(ngModel)]="model.alterEgo" name="alterEgo">
|
[(ngModel)]="model.alterEgo" name="alterEgo">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="power">Hero Power</label>
|
<label for="power">Hero Power</label>
|
||||||
<select class="form-control" required
|
<select class="form-control" id="power"
|
||||||
[(ngModel)]="model.power" name="power">
|
required
|
||||||
|
[(ngModel)]="model.power" name="power">
|
||||||
<option *ngFor="let p of powers" [value]="p">{{p}}</option>
|
<option *ngFor="let p of powers" [value]="p">{{p}}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
@ -175,15 +179,17 @@
|
||||||
<!-- EXTRA MATERIAL FOR DOCUMENTATION -->
|
<!-- EXTRA MATERIAL FOR DOCUMENTATION -->
|
||||||
<hr>
|
<hr>
|
||||||
<!-- #docregion ngModel-1-->
|
<!-- #docregion ngModel-1-->
|
||||||
<input type="text" class="form-control" required
|
<input type="text" class="form-control" id="name"
|
||||||
[(ngModel)]="model.name" name="name">
|
required
|
||||||
|
[(ngModel)]="model.name" name="name">
|
||||||
TODO: remove this: {{model.name}}
|
TODO: remove this: {{model.name}}
|
||||||
<!-- #enddocregion ngModel-1-->
|
<!-- #enddocregion ngModel-1-->
|
||||||
<hr>
|
<hr>
|
||||||
<!-- #docregion ngModel-3-->
|
<!-- #docregion ngModel-3-->
|
||||||
<input type="text" class="form-control" required
|
<input type="text" class="form-control" id="name"
|
||||||
[ngModel]="model.name"
|
required
|
||||||
(ngModelChange)="model.name = $event" >
|
[ngModel]="model.name" name="name"
|
||||||
|
(ngModelChange)="model.name = $event" >
|
||||||
TODO: remove this: {{model.name}}
|
TODO: remove this: {{model.name}}
|
||||||
<!-- #enddocregion ngModel-3-->
|
<!-- #enddocregion ngModel-3-->
|
||||||
<hr>
|
<hr>
|
||||||
|
@ -192,15 +198,16 @@
|
||||||
<!-- #enddocregion form-active -->
|
<!-- #enddocregion form-active -->
|
||||||
|
|
||||||
<!-- #docregion ngModelName-1 -->
|
<!-- #docregion ngModelName-1 -->
|
||||||
<input type="text" class="form-control" required
|
<input type="text" class="form-control" id="name"
|
||||||
[(ngModel)]="model.name"
|
required
|
||||||
name="name" >
|
[(ngModel)]="model.name" name="name" >
|
||||||
<!-- #enddocregion ngModelName-1 -->
|
<!-- #enddocregion ngModelName-1 -->
|
||||||
<hr>
|
<hr>
|
||||||
<!-- #docregion ngModelName-2 -->
|
<!-- #docregion ngModelName-2 -->
|
||||||
<input type="text" class="form-control" required
|
<input type="text" class="form-control" id="name"
|
||||||
[(ngModel)]="model.name"
|
required
|
||||||
name="name" #spy >
|
[(ngModel)]="model.name" name="name"
|
||||||
|
#spy >
|
||||||
<br>TODO: remove this: {{spy.className}}
|
<br>TODO: remove this: {{spy.className}}
|
||||||
<!-- #enddocregion ngModelName-2 -->
|
<!-- #enddocregion ngModelName-2 -->
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
// #docregion
|
// #docregion
|
||||||
// #docregion first, final
|
// #docregion first, final
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { NgForm } from '@angular/forms';
|
|
||||||
|
|
||||||
import { Hero } from './hero';
|
import { Hero } from './hero';
|
||||||
|
|
||||||
|
@ -51,7 +50,7 @@ export class HeroFormComponent {
|
||||||
|
|
||||||
// Reveal in html:
|
// Reveal in html:
|
||||||
// Name via form.controls = {{showFormControls(heroForm)}}
|
// Name via form.controls = {{showFormControls(heroForm)}}
|
||||||
showFormControls(form: NgForm) {
|
showFormControls(form: any) {
|
||||||
|
|
||||||
return form && form.controls['name'] &&
|
return form && form.controls['name'] &&
|
||||||
// #docregion form-controls
|
// #docregion form-controls
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
// #docregion
|
// #docregion
|
||||||
import { bootstrap } from '@angular/platform-browser-dynamic';
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||||
import { disableDeprecatedForms, provideForms } from '@angular/forms';
|
import { AppModule } from './app.module';
|
||||||
|
|
||||||
import { AppComponent } from './app.component';
|
// Compiles the module (asynchronously) with the runtime compiler
|
||||||
|
// which generates a compiled module factory in memory.
|
||||||
bootstrap(AppComponent, [
|
// Then bootstraps with that factory, targeting the browser.
|
||||||
disableDeprecatedForms(),
|
platformBrowserDynamic().bootstrapModule(AppModule);
|
||||||
provideForms()
|
|
||||||
])
|
|
||||||
.catch((err: any) => console.error(err));
|
|
||||||
|
|
|
@ -7,7 +7,8 @@
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
||||||
<!-- #docregion bootstrap -->
|
<!-- #docregion bootstrap -->
|
||||||
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
|
<link rel="stylesheet"
|
||||||
|
href="node_modules/bootstrap/dist/css/bootstrap.min.css">
|
||||||
<!-- #enddocregion bootstrap -->
|
<!-- #enddocregion bootstrap -->
|
||||||
<!-- #docregion styles -->
|
<!-- #docregion styles -->
|
||||||
<link rel="stylesheet" href="styles.css">
|
<link rel="stylesheet" href="styles.css">
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
// #docregion
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
|
import { FormsModule } from '@angular/forms';
|
||||||
|
|
||||||
|
import { HeroesListComponent } from './heroes-list.component';
|
||||||
|
import { HeroEditorComponent } from './hero-editor.component';
|
||||||
|
import { HeroCardComponent } from './hero-card.component';
|
||||||
|
import { HeroesService } from './heroes.service';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
BrowserModule,
|
||||||
|
FormsModule
|
||||||
|
],
|
||||||
|
providers: [ HeroesService ],
|
||||||
|
declarations: [
|
||||||
|
HeroesListComponent,
|
||||||
|
HeroCardComponent,
|
||||||
|
HeroEditorComponent
|
||||||
|
],
|
||||||
|
bootstrap: [ HeroesListComponent ]
|
||||||
|
})
|
||||||
|
export class AppModule { }
|
||||||
|
|
||||||
|
/* Documentation artifact below
|
||||||
|
// #docregion bad-alternative
|
||||||
|
// Don't do this!
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
BrowserModule,
|
||||||
|
FormsModule
|
||||||
|
],
|
||||||
|
providers: [ HeroesService, RestoreService ],
|
||||||
|
declarations: [ HeroesListComponent ],
|
||||||
|
bootstrap: [
|
||||||
|
HeroesListComponent,
|
||||||
|
HeroCardComponent,
|
||||||
|
HeroEditorComponent
|
||||||
|
]
|
||||||
|
})
|
||||||
|
// #enddocregion bad-alternative
|
||||||
|
*/
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue