Created
May 24, 2019 18:41
-
-
Save supunsandeeptha/fee55c0ae1d3f14e481e54928a64a0fe 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 } from '@angular/core'; | |
import {HttpClient} from '@angular/common/http'; | |
@Component({ | |
selector: 'app-home', | |
templateUrl: 'home.page.html', | |
styleUrls: ['home.page.scss'], | |
}) | |
export class HomePage { | |
name:any; | |
showResponse; | |
constructor(private HttpClient : HttpClient) {} //injecting the http client to the constructor | |
send(){ | |
let sendName = { | |
name:this.name | |
} | |
this.HttpClient.post('http://localhost:9000/send',sendName).subscribe( | |
response =>{ | |
console.log(response); //logging the response | |
let x = response; | |
this.showResponse = response; | |
alert(x); | |
} | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment