angular-cn/public/docs/_examples/component-styles/ts/app/hero-controls.component.ts
Patrice Chalin ef66e38e54 docs(dev guide): Update 'Component Styles' prose (#1320)
Reowork Ts prose and add Dart prose/code

+ Updates to docs and example code

(Starting point for Dart code was taken from #1171.)
2016-05-10 08:51:23 +01:00

26 lines
499 B
TypeScript

import { Component, Input } from '@angular/core';
import { Hero } from './hero';
// #docregion inlinestyles
@Component({
selector: 'hero-controls',
template: `
<style>
button {
background-color: white;
border: 1px solid #777;
}
</style>
<h3>Controls</h3>
<button (click)="activate()">Activate</button>
`
})
// #enddocregion inlinestyles
export class HeroControlsComponent {
@Input() hero: Hero;
activate() {
this.hero.active = true;
}
}