Javascript ASP.NET MVC应用程序中的角度路由
我有一个链接如下:Javascript ASP.NET MVC应用程序中的角度路由,javascript,angularjs,asp.net-mvc,Javascript,Angularjs,Asp.net Mvc,我有一个链接如下: <a href="#/Home">view</a> 在单击链接之前,URL将显示http://localhost:58679/#/Home单击后,地址栏将转到http://localhost:58679/#!#%2主页 基本上什么也没发生,我的home.html也没有按预期的方式呈现 包括$locationProvider.hashPrefix(“”) myApp = angular.module("myApp", ["ngRoute"]) .con
<a href="#/Home">view</a>
在单击链接之前,URL将显示http://localhost:58679/#/Home
单击后,地址栏将转到http://localhost:58679/#!#%2主页
基本上什么也没发生,我的
home.html
也没有按预期的方式呈现 包括$locationProvider.hashPrefix(“”)在您的配置中编码>
myApp = angular.module("myApp", ["ngRoute"])
.config(function ($routeProvider,$locationProvider) {
$locationProvider.hashPrefix('');
$routeProvider
.when("/Home", {
templateUrl: "Templates/Home.html",
controller: "HomeController"
})
})
包括
$locationProvider.hashPrefix(“”)在您的配置中编码>
myApp = angular.module("myApp", ["ngRoute"])
.config(function ($routeProvider,$locationProvider) {
$locationProvider.hashPrefix('');
$routeProvider
.when("/Home", {
templateUrl: "Templates/Home.html",
controller: "HomeController"
})
})
非常感谢。“我不明白这为什么有效,它有什么作用?”萨米尔布洛斯在这里读到,谢谢。“我不明白这为什么有效,它有什么作用?”萨米尔布洛斯在这里读道
myApp = angular.module("myApp", ["ngRoute"])
.config(function ($routeProvider,$locationProvider) {
$locationProvider.hashPrefix('');
$routeProvider
.when("/Home", {
templateUrl: "Templates/Home.html",
controller: "HomeController"
})
})