0
私の角張ったアプリケーションから、URLから#値を削除する必要があります。例として、このURLをパラメータ名cal name
で実行し、htmlページ。URLからハッシュ記号(#)を削除した後にurlパラメータを処理するAngularJs
例:
THIS URL:に
http://localhost/angular_ex/url.html#?name=test
:
http://localhost/angular_ex/url.html?name=test
C#WebRequestクラスからウェブを送信することはできませんでしたので要求tとハッシュ値を比較します。
このスタックオーバーフローを使用しようとしましたpost
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>
index.js
var newApp = angular.module('HelloApp', []);
newApp.controller('myCtrl', newAppConstructor);
newAppConstructor.$inject = ['$scope', '$location'];
function newAppConstructor($scope, $location) {
$scope.name = $location.search().name;
}
で試してみてください/ questions/16677528/location-switching-between-html5-and-hashban gモードリンクの書き換え – Hosar
あなたのルートはどこですか? '$ locationProvider.html5Mode(true)'を追加しましたか? – Sravan