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,5 @@
|
||||
<!-- #docregion -->
|
||||
<!-- avoid -->
|
||||
|
||||
<toh-hero-button labelAttribute="OK" (changeEvent)="doSomething()">
|
||||
</toh-hero-button>
|
@ -0,0 +1,6 @@
|
||||
<!-- #docregion -->
|
||||
<toh-hero-button label="OK" (change)="doSomething()">
|
||||
</toh-hero-button>
|
||||
|
||||
<!-- `heroHighlight` is both the directive name and the data-bound aliased property name -->
|
||||
<h3 heroHighlight="skyblue">The Great Bombasto</h3>
|
@ -0,0 +1,7 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'sg-app',
|
||||
templateUrl: './app.component.html'
|
||||
})
|
||||
export class AppComponent { }
|
17
aio/content/examples/styleguide/src/05-13/app/app.module.ts
Normal file
17
aio/content/examples/styleguide/src/05-13/app/app.module.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import { AppComponent } from './app.component';
|
||||
import { HeroButtonComponent, HeroHighlightDirective } from './heroes';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([{ path: '05-13', component: AppComponent }])
|
||||
],
|
||||
declarations: [
|
||||
AppComponent,
|
||||
HeroButtonComponent, HeroHighlightDirective
|
||||
],
|
||||
exports: [ AppComponent ]
|
||||
})
|
||||
export class AppModule {}
|
@ -0,0 +1 @@
|
||||
export * from './shared';
|
@ -0,0 +1,14 @@
|
||||
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
||||
// #docregion example
|
||||
/* avoid pointless aliasing */
|
||||
|
||||
@Component({
|
||||
selector: 'toh-hero-button',
|
||||
template: `<button>{{label}}</button>`
|
||||
})
|
||||
export class HeroButtonComponent {
|
||||
// Pointless aliases
|
||||
@Output('changeEvent') change = new EventEmitter<any>();
|
||||
@Input('labelAttribute') label: string;
|
||||
}
|
||||
// #enddocregion example
|
@ -0,0 +1,14 @@
|
||||
// #docregion
|
||||
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
||||
|
||||
// #docregion example
|
||||
@Component({
|
||||
selector: 'toh-hero-button',
|
||||
template: `<button>{{label}}</button>`
|
||||
})
|
||||
export class HeroButtonComponent {
|
||||
// No aliases
|
||||
@Output() change = new EventEmitter<any>();
|
||||
@Input() label: string;
|
||||
}
|
||||
// #enddocregion example
|
@ -0,0 +1 @@
|
||||
export * from './hero-button.component';
|
@ -0,0 +1,15 @@
|
||||
// #docregion
|
||||
import { Directive, ElementRef, Input, OnChanges } from '@angular/core';
|
||||
|
||||
@Directive({ selector: '[heroHighlight]' })
|
||||
export class HeroHighlightDirective implements OnChanges {
|
||||
|
||||
// Aliased because `color` is a better property name than `heroHighlight`
|
||||
@Input('heroHighlight') color: string;
|
||||
|
||||
constructor(private el: ElementRef) {}
|
||||
|
||||
ngOnChanges() {
|
||||
this.el.nativeElement.style.backgroundColor = this.color || 'yellow';
|
||||
}
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
export * from './hero-button';
|
||||
export * from './hero-highlight.directive';
|
2
aio/content/examples/styleguide/src/05-13/app/index.ts
Normal file
2
aio/content/examples/styleguide/src/05-13/app/index.ts
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './heroes';
|
||||
export * from './app.component';
|
Reference in New Issue
Block a user