Last active
January 4, 2020 09:20
-
-
Save Kalpesh300/c8ec5531efce026c1dbc8f5ccdaef06a to your computer and use it in GitHub Desktop.
Demo Component
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, Input } from '@angular/core'; | |
import { HttpClient } from '@angular/common/http'; | |
import { FormControl } from '@angular/forms'; | |
@Component({ | |
selector: 'app-demo', | |
templateUrl: './demo.component.html', | |
styleUrls: ['./demo.component.scss'] | |
}) | |
export class Demo implements OnInit { | |
tempProperty: string; | |
tempData: any; | |
tempFormControl: FormControl; | |
constructor(private httpClient: HttpClient) { | |
this.tempFromControl = new FormControl(null); | |
} | |
ngOnInit() { | |
this.tempProperty = 'Hello World!'; | |
this.httpClient.get('https://apiendpoint/').subscribe( | |
(response) => { | |
this.tempData = response; | |
} | |
); | |
this.tempFormControl.valueChanges.subscribe( | |
(value) => { | |
console.log(value); | |
} | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment