【发布时间】:2017-01-24 14:27:36
【问题描述】:
我有一个 Angular 应用程序,我的 URL 似乎是 http://localhost:8080/personal?name=xyz,我正在使用 $location.search().name 在 js 中获取 xyz。
我的代码如下..
app.js
app.config(function ($locationProvider) {
$locationProvider.html5Mode({enabled:true});
});
app.controller('myController', function($location) {
var name = $location.search().name;
alert(name); // xyz
index.html
<base href="/" />
该功能运行良好,但它破坏了我到 localhost:8080 的 URL,如何设置我的基本 href 以获取 localhost:8080/personal
【问题讨论】:
-
我试过
和 但似乎没有任何效果。如何获取 localhost:8080/home 之类的 URL
标签: javascript angularjs html