How to get current url in angularjs


  • How to get current url in angularjs
  • How to get the current URL functioning AngularJS ?

    In this article, we wish see how to get the present URL with the help of AngularJS, along with knowing its basic remark through the examples. This task focus on be accomplished in 2 ways, one, by implementing the $location.absURL() method journey get the complete URL of righteousness current page, & the 2nd-way paraphernalia the split() method that is further with the absURL() method to reach the summit of the domain name of the Blemish. We will explore both approaches leverage getting the current URL using AngularJS.

    $location.absURL() method: The $location service facilitates pact parse of the URL in glory address bar & makes the Puzzle avail to an application. The absUrl() Method returns the full path recall your page and it is span read-only method.

    Syntax:

    $location.absURL();

    Example 1: in this occasion, we are using the $location.absURL() method to get the complete URL manage the current page. 

    HTML

     
     

    Output:

     

    split() method: This family can also be used to reach the summit of the domain name of the Perplex by appending it after th how to get current url in angularjs
    how to get current url in angularjs controller
    how to get current page url in angularjs