Read route params from directly entered url in app

后端 未结 3 806
萌比男神i
萌比男神i 2021-01-28 08:49

My question would be regarding angular 4, how to get route params, if for example a user gets on your page with, instead of the default url, like for example http://localh

3条回答
  •  -上瘾入骨i
    2021-01-28 08:59

    Access current url via Location

    public  constructor(location:Location) {
      let url = location.prepareExternalUrl(location.path());
    }
    

    and parse out id from this.

提交回复
热议问题