SoFunction
Updated on 2025-04-11

How to get parameters carried in angularJS1 url

From this interface, jump to the interface

<!doctype html>
<html>

  <head>
    <meta charset="utf-8">
    <title>form demo</title>
    <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0" />
    <script src="js/.1.6."></script>
  </head>

  <body ng-app="app" ng-controller="myctrl">

    <button ng-click="jump()" >Click to jump to the next page</button>
    <br /><br />
    <a ng-href="?name=xie&age=25&gender=nv" rel="external nofollow" >Click to jump to the next page</a>
    </div>
  </body>

  <script>
    var app = ('app', []);
    ('myctrl', function($scope, $window) {
      $ = function() {
        $ = '?name=xie&age=25&gender=nv';
      }
    });
  </script>

</html>

Jump to the target interface, and get the parameters carried by the url in this interface:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0" />
    <script src="js/.1.6."></script>
    <title></title>
  </head>
  <body ng-app="myapp" ng-controller="myctrl" >
    <p></p>


  </body>
  <script>
  //Url="http://168.33.222.69:8020/angularjs_demo/?name=xie&age=25&gender=nv";
    var app=("myapp",[]);
    (['$locationProvider', function($locationProvider) { 
     // $locationProvider.html5Mode(true); 
     $locationProvider.html5Mode({
     enabled: true,
     requireBase: false
    });
    }]);


    ('myctrl', function($scope, $location) {


     ($().name);
     ($().age);
     ($().gender);

    }); 

//Print result://[Web browser] "xie"//[Web browser] "25"//[Web browser] "nv"

  </script>
</html>

The above method of obtaining parameters in the angularJS1 url is all the content I share with you. I hope you can give you a reference and I hope you can support me more.