Skip to content

Instantly share code, notes, and snippets.

@israeljrs
Created February 18, 2019 16:27
Show Gist options
  • Save israeljrs/627a36803564fc34c21a897a47f18706 to your computer and use it in GitHub Desktop.
Save israeljrs/627a36803564fc34c21a897a47f18706 to your computer and use it in GitHub Desktop.
home page ts para o exemplo rxjs timeout
import { Component, OnInit } from '@angular/core';
import { WebRequestService } from '../services/web-request.service';
@Component({
selector: 'app-home-page',
templateUrl: './home-page.component.html',
styleUrls: ['./home-page.component.scss']
})
export class HomePageComponent implements OnInit {
msg = 'Clique no botão para consulta !!!';
constructor(private req: WebRequestService) { }
ngOnInit() {
}
btnClickRequest() {
this.req.getArticle().subscribe(res => {
this.msg = `title: ${res.title}`;
console.log(res);
}, (error) => {
this.msg = error.message;
console.log(error);
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment