0
public Role;
ngOnInit() {

    this.getRole()
    {
      this.roleserive.getrole(this.token)
      .subscribe(
        res => {
          this.Role = res;
          console.log(this.Role)

        }
      )
    }
    console.log(this.Role)

   if(this.Role == 'emp')
   {
      this.getAllProjects();
   }
}

when i use console.log in function browser show the value of role but when i use it after function angular can't read the value of role

ghassan sy
  • 75
  • 1
  • 7
  • Does this answer your question? [How do I return the response from an asynchronous call?](https://stackoverflow.com/questions/14220321/how-do-i-return-the-response-from-an-asynchronous-call) – Igor Dec 09 '19 at 21:11
  • Does this answer your question? [How do I return the response from an Observable/http/async call in angular?](https://stackoverflow.com/q/43055706/1260204) – Igor Dec 09 '19 at 21:11
  • yes it's the answer of my question , thanks a lot – ghassan sy Dec 09 '19 at 21:13

0 Answers0