mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
add types to all the buttons in the angular.io examples to encourage the best practice of always including a type per button (regardless to whether it is in a form or now) PR Close #44557
25 lines
518 B
TypeScript
25 lines
518 B
TypeScript
import { Component, Input } from '@angular/core';
|
|
import { Hero } from './hero';
|
|
|
|
// #docregion inlinestyles
|
|
@Component({
|
|
selector: 'app-hero-controls',
|
|
template: `
|
|
<style>
|
|
button {
|
|
background-color: white;
|
|
border: 1px solid #777;
|
|
}
|
|
</style>
|
|
<h3>Controls</h3>
|
|
<button type="button" (click)="activate()">Activate</button>
|
|
`
|
|
})
|
|
// #enddocregion inlinestyles
|
|
export class HeroControlsComponent {
|
|
@Input() hero!: Hero;
|
|
|
|
activate() {
|
|
this.hero.active = true;
|
|
}
|
|
}
|