Skip to content

Instantly share code, notes, and snippets.

@Kalpesh300
Last active January 4, 2020 09:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kalpesh300/c8ec5531efce026c1dbc8f5ccdaef06a to your computer and use it in GitHub Desktop.
Save Kalpesh300/c8ec5531efce026c1dbc8f5ccdaef06a to your computer and use it in GitHub Desktop.
Demo Component
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