如何订阅 angular js2 中的后端数据
how to subscribe to back end data in angular js2
导出 class 搜索 {
data: string;
prop: string = 'connenct';
details: ISearch[];
constructor(public http: Http,public _profileservice: GetSocietyList) {
this.http = http;
this._profileservice.getSocietyList()
.subscribe(
response => {
this.details = response;
})
})
}
我在这里订阅了对细节的全部回复,但我只想要我的细节的一部分,即 connection_status = 3 和 4.Can 有人请提供帮助。
只筛选你需要的
response => {
this.details = response.filter(
r => r.connection_status === 3 || r.connnection_status === 4);
导出 class 搜索 {
data: string;
prop: string = 'connenct';
details: ISearch[];
constructor(public http: Http,public _profileservice: GetSocietyList) {
this.http = http;
this._profileservice.getSocietyList()
.subscribe(
response => {
this.details = response;
})
})
}
我在这里订阅了对细节的全部回复,但我只想要我的细节的一部分,即 connection_status = 3 和 4.Can 有人请提供帮助。
只筛选你需要的
response => {
this.details = response.filter(
r => r.connection_status === 3 || r.connnection_status === 4);