角UI路由器忽略HTML5模式关闭

时间:2022-03-20 11:36:36

Angular UI Router is ignoring HTML5Mode(false), and it's rendering links in a way that can't be bookmarked or directly landing upon:

有棱角的UI路由器忽略了HTML5Mode(false),它呈现链接的方式不能被书签或直接登录:

app.js:

app.js:

$stateProvider
    .state('search', {
      url: '/search',
      views: {
        'main.wrapper': {
          templateUrl: 'views/search.html',
          controller: 'SearchCtrl'
        },
        'navbar': { templateUrl: 'views/search.navbar.html' }
      });

$locationProvider.html5Mode(false);

foo.html:

foo.html:

<a ui-sref="search">Search</a>

Becomes

就变成了

<a href="/search">Search</a>

Shouldn't it detect it's not on HTML5 Mode and return

它不应该检测到它不在HTML5模式下并返回

<a href="/#/search">Search</a>

1 个解决方案

#1


2  

As indicated by Radim Köhler, this is a bug between angular-ui-router ~0.2.11 and angular 1.3.0.

正如Radim Kohler所指出的,这是一个介于angular-ui-router ~0.2.11和尖角1.3.0之间的bug。

https://github.com/angular-ui/ui-router/issues/1397

https://github.com/angular-ui/ui-router/issues/1397

#1


2  

As indicated by Radim Köhler, this is a bug between angular-ui-router ~0.2.11 and angular 1.3.0.

正如Radim Kohler所指出的,这是一个介于angular-ui-router ~0.2.11和尖角1.3.0之间的bug。

https://github.com/angular-ui/ui-router/issues/1397

https://github.com/angular-ui/ui-router/issues/1397