使用 ui 路由器的 URL/状态名称是否有任何大小限制



我在创建具有有限字符的 AngularJS 路由时遇到问题,但是一旦我用 3 个字符更改路由名称>它就可以工作了。 请参阅我下面的代码:

var mainApp = angular.module("mainApp", ["ui.router", "ui.bootstrap"]);

当基于3个字符的路由不起作用时,重定向到主页

mainApp.config(function ($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise('/home');
$stateProvider
    .state('home', {
        url: '/home',
        templateUrl: 'templates/home/home.html'
    })
    .state('pin', {
        url: '/pin',
        templateUrl: 'templates/verification.html',
        controller: 'InstituteController'
    })
});

当>基于3个字符的路由时,它工作得很好

mainApp.config(function ($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise('/home');
$stateProvider
    .state('home', {
        url: '/home',
        templateUrl: 'templates/home/home.html'
    })
    .state('pinverification', {
        url: '/pinverification',
        templateUrl: 'templates/verification.html',
        controller: 'InstituteController'
    })
});

不,州名称或 URL 没有字符限制。您可能错过了代码中的其他内容。

下面是一个具有 1 个字符状态名称的演示:

Demo

最新更新