Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript AngularJs在从url中删除哈希符号(#)后使用url参数_Javascript_Angularjs - Fatal编程技术网

Javascript AngularJs在从url中删除哈希符号(#)后使用url参数

Javascript AngularJs在从url中删除哈希符号(#)后使用url参数,javascript,angularjs,Javascript,Angularjs,从angular应用程序中,我需要从URL中删除#值。例如,我需要使用参数名称calname执行此URL,然后它会显示在html页面中 例如: 此URL: <!DOCTYPE html> <html ng-app="HelloApp"> <head> <script src="./angular/angular.js"></script> <script src="https://code.jquery.com/j

从angular应用程序中,我需要从URL中删除#值。例如,我需要使用参数名称cal
name
执行此URL,然后它会显示在html页面中

例如:

此URL:

<!DOCTYPE html>
<html ng-app="HelloApp">
<head>
    <script src="./angular/angular.js"></script>
    <script src="https://code.jquery.com/jquery-3.1.1.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script>
    <script src="index.js"></script>
    </head>
    <body ng-controller="myCtrl">
        <p>Url parameter value is :{{name}}</p>
    </body>

</html>

输入到:

<!DOCTYPE html>
<html ng-app="HelloApp">
<head>
    <script src="./angular/angular.js"></script>
    <script src="https://code.jquery.com/jquery-3.1.1.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script>
    <script src="index.js"></script>
    </head>
    <body ng-controller="myCtrl">
        <p>Url parameter value is :{{name}}</p>
    </body>

</html>

因为from C#WebRequest类不允许将web请求与哈希值一起发送

我也尝试使用这个堆栈溢出

Html代码:

<!DOCTYPE html>
<html ng-app="HelloApp">
<head>
    <script src="./angular/angular.js"></script>
    <script src="https://code.jquery.com/jquery-3.1.1.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script>
    <script src="index.js"></script>
    </head>
    <body ng-controller="myCtrl">
        <p>Url parameter value is :{{name}}</p>
    </body>

</html>
试试这个答案

newApp.config(function($locationProvider) {
    $locationProvider.html5Mode({
     enabled: true,
     requireBase: false
     });
  })

也许这能帮你找到你的路线?您是否添加了
$locationProvider.html5Mode(true)