initial codebase
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { finalize } from 'rxjs/operators';
|
||||
|
||||
import { QuoteService } from './quote.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-home',
|
||||
templateUrl: './home.component.html',
|
||||
styleUrls: ['./home.component.scss']
|
||||
})
|
||||
export class HomeComponent implements OnInit {
|
||||
|
||||
quote: string;
|
||||
isLoading: boolean;
|
||||
|
||||
constructor(private quoteService: QuoteService) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.isLoading = true;
|
||||
this.quoteService.getRandomQuote({ category: 'dev' })
|
||||
.pipe(finalize(() => { this.isLoading = false; }))
|
||||
.subscribe((quote: string) => { this.quote = quote; });
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user