trouve(id:number):boolean{
var bool :boolean =false
this.comapanyService.query().subscribe((resula)=>{
for (let i = 0; i < resula.json.length; i++) {
try {
if( id == resula.json[i].user.id)
{
console.log('id-user:',id ,'user in company:',resula.json[i].user.id,'company :',resula.json[i].id )
bool = true
}
}
catch (error) {}
}
console.log('bool fin pour :',bool)
})
console.log(bool)
if(bool) return true;else return false
}
confirmDelete(login) {
this.userService.find(login).subscribe((response)=>{
const id =response.id
console.log('resulta :', this.trouve(id))
})
}
- resulta : false
- id-user: 7202
- user in company: 7202 company : 5151
- bool fin pour : true
Why do I always get a false
?