I am new at Angular and using Firebase. When I check user login my function always return 0 even I did correct checking. My problem is my return value comes from outside.
checkLog(mail: string, password: string): number {
let isTrue = 0;
this.http.get(exampleJson).subscribe(resData => {
for (let data in resData) {
this.http.get<User_model>(exampleJson' + data + '/.json').subscribe(res2Data => {
console.log('Name = ', res2Data.user_name, 'Password = ', res2Data.password);
if (mail === res2Data.user_name && password === res2Data.password) {
isTrue = 1;
}
})
}
});
return isTrue;
}