HttpService in Angular Framework:-
It is used to handle HttpRequest from external resources and fetch data from external resources .we will create web API or web services to get data from a remote server,web services, and web API will be called by HttpService in Angular Framework.
Web Services will be created by Server side script such as Java,PHP,.NET, PYTHON, Ruby, etc, and Consumed by Angular HTTP Service.
in Angular (currently on Angular-6) .subscribe() is a method on the Observable type. The Observable type is a utility that asynchronously or synchronously streams data to a variety of components or services that have subscribed to the observable.
import { Component, OnInit } from '@angular/core';
import { MyserviceService } from '../myservice.service';
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.css']
})
export class HomeComponent implements OnInit {
s;
public persondata = [];
constructor(private myser: MyserviceService) {
this.s= this.myser.show()
}
ngOnInit() {
this.myser.getData().subscribe((data) => {
this.persondata = Array.from(Object.keys(data), k=>data[k]);
});
}
}
It is used to handle HttpRequest from external resources and fetch data from external resources .we will create web API or web services to get data from a remote server,web services, and web API will be called by HttpService in Angular Framework.
Web Services will be created by Server side script such as Java,PHP,.NET, PYTHON, Ruby, etc, and Consumed by Angular HTTP Service.
in Angular (currently on Angular-6) .subscribe() is a method on the Observable type. The Observable type is a utility that asynchronously or synchronously streams data to a variety of components or services that have subscribed to the observable.
import { Component, OnInit } from '@angular/core';
import { MyserviceService } from '../myservice.service';
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.css']
})
export class HomeComponent implements OnInit {
s;
public persondata = [];
constructor(private myser: MyserviceService) {
this.s= this.myser.show()
}
ngOnInit() {
this.myser.getData().subscribe((data) => {
this.persondata = Array.from(Object.keys(data), k=>data[k]);
});
}
}
POST Answer of Questions and ASK to Doubt