Created
June 30, 2018 23:13
-
-
Save zkkmin/269fcbd8f6a7163d2c94eac5425ae242 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, OnInit } from '@angular/core'; | |
import { QuoteService } from '../quote.service'; | |
@Component({ | |
selector: 'app-random-quote', | |
templateUrl: './random-quote.component.html', | |
styleUrls: ['./random-quote.component.css'] | |
}) | |
export class RandomQuoteComponent implements OnInit { | |
constructor(private quoteService: QuoteService) { } | |
getQuote(): void { | |
this.quoteService.getQuote() | |
.subscribe(quote => { | |
this.quote = '"' + quote['quote'] + '"'; | |
this.author = '~' + quote['author'] | |
}); | |
} | |
quote: string; | |
author: string; | |
ngOnInit() { | |
this.getQuote(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment