How can I access __zone_symbol__value in ZoneAwarePromise in Angular 2

I get ZoneAwarePromise, and when I registered it in the console, I found that it contains __zone_symbol__value. I was wondering if it is possible to set a variable equal to __zone_symbol__value?

+4
source share
4 answers

As you know, storage.get returns a promise, not a value. You need to deploy the promise in .then

strorage.get('key')
.then( res => console.log(res));
0
source

I do it like this:

  ngOnInit() {    
    console.log(" Ticket initialized");
    this.getBranchTickets().then(data => console.log(data));
  }

  getBranchTickets() {
   return this.ticketService.getBranchTickets().$promise;
  }
0
source

in your view you can access using async for the channel

(variable | async) ?. field

0
source

Make sure you are not returning an asynchronous object (e.g. Observable or Promise) instead of the primitive, Object, Array e etc

-2
source

Source: https://habr.com/ru/post/1675992/


All Articles