zoukankan      html  css  js  c++  java
  • 夺命雷公狗—angularjs—14—$location的作用

    废话不多说看下,我们直接来走代码看下效果如何

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
        <script src="js/angular.min.js"></script>
    </head>
    <body ng-app="myapp">
        <div ng-controller="app">
            <p>protocol-----{{protocol}}</p>
            <p>absUrl-----{{absUrl}}</p>
            <p>-----{{port}}</p>
            <p>port-----{{path}}</p>
            <p>search-----{{search}}</p>
            <p>search2-----{{search2}}</p>
            <p>search3-----{{search3}}</p>
        </div>
    </body>
    <script>
        var app = angular.module('myapp',[]);
        app.controller('app',function($scope,$location){
            $scope.protocol = $location.protocol();
            $scope.absUrl = $location.absUrl();
            $scope.port = $location.port();
            $scope.path = $location.path();
            $scope.hash = $location.hash();
            $scope.search = $location.search();
            //$scope.search2 = $location.search("user=admin&pass=passwd");
            $scope.search3 = $location.search({"usera":"admin","userpass":"admin123"});
        });
    </script>
    </html>

    最终效果如下所示:

  • 相关阅读:
    Linux系统常见的压缩与打包
    java 语言规范 java language specifications
    java 枚举
    github邮箱验证技巧
    关于 python
    博客园 编程基础 精华
    fiddler
    一个牛人写的博客
    使用xmarks同步 chrome ie firefox safari书签
    linux 中的 tar 解压
  • 原文地址:https://www.cnblogs.com/leigood/p/5789548.html
Copyright © 2011-2022 走看看