Simple URL
Let's start with this simple URL /inbox/33
.
This is how the router will encode the information about this URL:
const url: UrlSegment[] = [ {path: 'inbox', params: {}}, {path: '33', params: {}} ];
Where UrlSegment
is defined as follows:
interface UrlSegment { path: string; params: {[name:string]:string}; }
We can use the ActivatedRoute
object to get the URL segments consumed by the route:
class MessageCmp { constructor(r: ActivatedRoute) { r.url.forEach((u: UrlSegment[]) => { //... }); } }