Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Component, NgModule } from '@angular/core';
- import { FormsModule } from '@angular/forms';
- import { CommonModule } from '@angular/common';
- import { HttpClient, HttpClientModule } from '@angular/common/http';
- import { Response } from '@angular/http';
- import { ektp } from './ektp.model';
- import { Observable } from 'rxjs/Observable';
- import { HttpErrorResponse } from '@angular/common/http/src/response';
- import { Http } from '@angular/http/src/http';
- import { OnInit } from '@angular/core/src/metadata/lifecycle_hooks';
- import { Body } from '@angular/http/src/body';
- import { error } from 'util';
- @Component({
- selector: 'app-root',
- templateUrl: './app.component.html',
- styleUrls: ['./app.component.css'],
- })
- export class AppComponent {
- ambilDataKTP: ektp[];
- //openState
- panelOpenState: boolean = true;
- ErrMessage: string = '';
- showSpinner: boolean = false;
- name: string = '';
- noNIK: number;
- RESPON: string;
- NAMA_LNGKP: string;
- found: boolean
- constructor(private httpClient: HttpClient) { }
- inputNoNik(event: any) {
- this.noNIK = event.target.value;
- }
- postProfile() {
- this.ErrMessage = ''
- this.showSpinner = true;
- setTimeout(() => {
- const bodyParam = {
- NIK: `${this.noNIK}`,
- ip_user: 'ip',
- user_id: 'userid',
- password: 'pass'
- }
- this.httpClient.post("API Address", bodyParam)
- .subscribe((data: any[]) => {
- console.log(data)
- this.showSpinner = false;
- })
- }, 2000)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement