Looking to extract a value from the URL using promises and async/await, but encountering an issue where both Chrome and Opera seem to hang at that point. Can anyone steer me in the right direction or identify what I might be doing wrong?
My component implements: ngOnInit
Constructor:
constructor(private route: ActivatedRoute,
private zone : NgZone
)
{
}
Imports:
import { Component, OnInit, NgZone } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Observable } from 'rxjs/Rx';
Methods:
async ngOnInit()
{
var Id : string = await this.getIdFromUrl();
}
getIdFromUrl() : Promise<string>
{
return this.route.params.map(params =>
{
return params['id'];
}).toPromise();
}