I'm Rituraj, a Developer @Nagarro. founder of Maddyzone. JavaScript, Angular, Node.

Buy Me a Coffee at ko-fi.com

How to set absolute and relative url in angular2

Most of the time we need to set url somtimes its Absolute or some times its Relative. so lets start we will check one by one.

How to set Absolute URL

To set Absolute url we need to set `/` in starting of url by this url behave as Absolute.
<a href="/user"></a>

Now if we are on http://www.maddyzone.com/home then it will redirect to http://www.maddyzone.com/user.

How to set Relative URL

To set Relative url we no need to set `/` in starting of url by this url behave as Relative.
<a href="user"></a>

Now if we are on http://www.maddyzone.com/home then it will redirect to http://www.maddyzone.com/home/user.

for any query , please comment or feedback me for this blog , how do you like this.


Rituraj Ratan

I'm Rituraj, a Developer @Nagarro. Founder of Maddyzone .