docs(aio): rename cb- files and a few others
This commit is contained in:

committed by
Pete Bacon Darwin

parent
c3fa8803d3
commit
93516ea8a1
@ -0,0 +1,27 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
import { ToastService } from './core';
|
||||
|
||||
@Component({
|
||||
selector: 'sg-app',
|
||||
template: `
|
||||
<button (click)="show()">Show toast</button>
|
||||
<button (click)="hide()">Hide toast</button>
|
||||
`,
|
||||
providers: [ToastService]
|
||||
})
|
||||
export class AppComponent implements OnInit {
|
||||
constructor(private toastService: ToastService) { }
|
||||
|
||||
hide() {
|
||||
this.toastService.hide();
|
||||
}
|
||||
|
||||
show() {
|
||||
this.toastService.show();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.toastService.activate('Hello Style Guide!');
|
||||
}
|
||||
}
|
17
aio/content/examples/styleguide/src/03-04/app/app.module.ts
Normal file
17
aio/content/examples/styleguide/src/03-04/app/app.module.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import { AppComponent } from './app.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
BrowserModule,
|
||||
RouterModule.forChild([{ path: '03-04', component: AppComponent }])
|
||||
],
|
||||
declarations: [
|
||||
AppComponent
|
||||
],
|
||||
exports: [ AppComponent ]
|
||||
})
|
||||
export class AppModule {}
|
@ -0,0 +1 @@
|
||||
export * from './toast.service';
|
@ -0,0 +1,27 @@
|
||||
// #docregion
|
||||
// #docregion example
|
||||
/* avoid */
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable()
|
||||
export class ToastService {
|
||||
message: string;
|
||||
|
||||
private _toastCount: number;
|
||||
|
||||
hide() {
|
||||
this._toastCount--;
|
||||
this._log();
|
||||
}
|
||||
|
||||
show() {
|
||||
this._toastCount++;
|
||||
this._log();
|
||||
}
|
||||
|
||||
private _log() {
|
||||
console.log(this.message);
|
||||
}
|
||||
}
|
||||
// #enddocregion example
|
@ -0,0 +1,32 @@
|
||||
// #docplaster
|
||||
// #docregion
|
||||
// #docregion example
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable()
|
||||
export class ToastService {
|
||||
message: string;
|
||||
|
||||
private toastCount: number;
|
||||
|
||||
hide() {
|
||||
this.toastCount--;
|
||||
this.log();
|
||||
}
|
||||
|
||||
show() {
|
||||
this.toastCount++;
|
||||
this.log();
|
||||
}
|
||||
|
||||
private log() {
|
||||
console.log(this.message);
|
||||
}
|
||||
// #enddocregion example
|
||||
// testing harness
|
||||
activate(message: string) {
|
||||
this.message = message;
|
||||
}
|
||||
// #docregion example
|
||||
}
|
||||
// #enddocregion example
|
2
aio/content/examples/styleguide/src/03-04/app/index.ts
Normal file
2
aio/content/examples/styleguide/src/03-04/app/index.ts
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './core';
|
||||
export * from './app.component';
|
Reference in New Issue
Block a user