So i'm trying to get the the value from the url and i want to do this with promise and async/await. But when i run this in both chrome and opera it just stands and wait on that point. Anyone got that can point me in the right direction or am i doing something wrong ?
My component implements : implements OnInit
Constructor :
constructor(private route: ActivatedRoute,
private zone : NgZone
)
{
}
The 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();
}