Advertisement
Guest User

Untitled

a guest
Dec 7th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. import { Component, NgModule } from '@angular/core';
  2. import { FormsModule } from '@angular/forms';
  3. import { CommonModule } from '@angular/common';
  4. import { HttpClient, HttpClientModule } from '@angular/common/http';
  5. import { Response } from '@angular/http';
  6. import { ektp } from './ektp.model';
  7. import { Observable } from 'rxjs/Observable';
  8. import { HttpErrorResponse } from '@angular/common/http/src/response';
  9. import { Http } from '@angular/http/src/http';
  10. import { OnInit } from '@angular/core/src/metadata/lifecycle_hooks';
  11. import { Body } from '@angular/http/src/body';
  12. import { error } from 'util';
  13.  
  14.  
  15. @Component({
  16. selector: 'app-root',
  17. templateUrl: './app.component.html',
  18. styleUrls: ['./app.component.css'],
  19.  
  20. })
  21. export class AppComponent {
  22. ambilDataKTP: ektp[];
  23. //openState
  24. panelOpenState: boolean = true;
  25. ErrMessage: string = '';
  26. showSpinner: boolean = false;
  27. name: string = '';
  28. noNIK: number;
  29. RESPON: string;
  30. NAMA_LNGKP: string;
  31. found: boolean
  32.  
  33. constructor(private httpClient: HttpClient) { }
  34. inputNoNik(event: any) {
  35. this.noNIK = event.target.value;
  36. }
  37.  
  38. postProfile() {
  39. this.ErrMessage = ''
  40. this.showSpinner = true;
  41.  
  42. setTimeout(() => {
  43. const bodyParam = {
  44. NIK: `${this.noNIK}`,
  45. ip_user: 'ip',
  46. user_id: 'userid',
  47. password: 'pass'
  48. }
  49.  
  50. this.httpClient.post("API Address", bodyParam)
  51. .subscribe((data: any[]) => {
  52. console.log(data)
  53. this.showSpinner = false;
  54. })
  55. }, 2000)
  56. }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement