加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

angularjs – 我使用角度,我的网址总是有一个“!”(感叹号)

发布时间:2020-12-17 07:51:53 所属栏目:安全 来源:网络整理
导读:例如: http://localhost/#!/login.html 我不需要“
例如:
http://localhost/#!/login.html

我不需要“!”.我该如何删除它?

eg:http://localhost/#/login.html

这是我的路由器代码:

// Redirect any unmatched url
$urlRouterProvider.otherwise("/login.html");
$stateProvider.state('login',{
    url: "/login.html",templateUrl: "views/login.html",data: {pageTitle: "login",isLeft: false},controller: "LoginCtrl",resolve: {
        deps: ['$ocLazyLoad',function ($ocLazyLoad) {
            return $ocLazyLoad.load({
                name: 'myApp',files: [
                    'controllers/LoginCtrl.js'
                ]
            });
        }]
    }
});

我认为Angular-ui-router可能有问题,但我找不到解决方案.

谢谢!

哈什邦模式

Hashbang模式是AngularJS用于为Angular提供深层链接功能的技巧
应用.在hashbang模式(html5模式的后备)中,URL路径采用前置#字符.
它们不会重写标记,也不需要任何服务器端支持. Hashbang
mode是AngularJS使用的默认模式,否则不会被告知.
hashbang URL如下所示:

07000

要明确并配置hashbang模式,需要在配置函数中配置
应用模块

We can also configure the hashPrefix,which,in hashbang mode,is the
! prefix. This prefix is part of the fallback mechanism that Angular
uses for older browsers. We can also configure this character.

要配置hashPrefix:

angular.module('myApp',['ngRoute'])
.config(['$locationProvider',function($locationProvider) {
$locationProvider.html5Mode(false);
$locationProvider.hashPrefix('!');
}]);

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读