src/app/app.component.ts
selector | app-root |
styleUrls | app.component.css |
templateUrl | ./app.component.html |
Properties |
Methods |
constructor(easter: EastereggService)
|
||||||
Defined in src/app/app.component.ts:10
|
||||||
Parameters :
|
hitMe |
hitMe()
|
Defined in src/app/app.component.ts:13
|
Returns :
void
|
hits |
hits:
|
Type : number
|
Default value : 0
|
Defined in src/app/app.component.ts:10
|
import { Component } from '@angular/core';
import { EastereggService } from '@app/core/easteregg.service';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
hits = 0;
constructor(private easter: EastereggService) {}
hitMe() {
this.hits++;
if (this.hits > 5) {
this.hits = 0;
this.easter.surprise();
} else {
console.log('One more time...');
}
}
}
<div class="easter" (click)="hitMe()"></div>
<router-outlet></router-outlet>