getSome() {
this.http.get('/some')
.subscribe( (data: Array<object>)=> {
console.log(data)
this.AllMaterial = data; // не делает запрос
}, err => {
console.log(err)
})
}
second() {
if (this.isEmpty(this.AllMaterial)) {
this.getSome();
}
console.log(this.AllMaterial)
}
async getSome() {
const data = await this.http.get('/some').toPromise();
console.log(data)
return data;
}
async second() {
if (this.isEmpty(this.AllMaterial)) {
this.AllMaterial = await this.getSome()
}
console.log(this.AllMaterial)
}
getSome() {
return this.http.get('/some')
}
second() {
if (this.isEmpty(this.AllMaterial)) {
this.getSome().subscribe( (data: Array<object>)=> {
console.log(data)
this.AllMaterial = data; // не делает запрос
console.log(this.AllMaterial)
}, err => {
console.log(err)
})
}
}