相关疑难解决方法(0)

angular ui路由器的默认路由

angular ui路由器的示例演示具有此开始页面的链接:

'ui-router'的完整网址是/http://angular-ui.github.io/ui-router/sample/#/

'about'的完整网址是/abouthttp://angular-ui.github.io/ui-router/sample/#/about

当我使用durandalJS时,有一个限制,默认网址只是"/",可能没有"/ ui-router".

角度ui路由器插件有相同的限制吗?

angularjs angular-ui-router

19
推荐指数
4
解决办法
5万
查看次数

ui-router的$ urlRouterProvider.otherwise与HTML5模式

请考虑ui-router的wiki中的以下略微修改的代码.

var myApp = angular.module('myApp',['ui.router']);

myApp.config(function($stateProvider, $urlRouterProvider, $locationProvider) {
    // for any unmatched url
    $urlRouterProvider.otherwise("/state1");

    $locationProvider.html5Mode(true);

    // now set up the states
    $stateProvider
        .state('state1', {
            url: '/state1',
            templateUrl: "partials/state1.html"
        })
        .state('state1.list', {
            url: "/list",
            templateUrl: "partials/state1.list.html",
            controller: function($scope) {
                $scope.items = ["A", "List", "of", "Items"];
            }
        })
        .state('state2', {
            url: "/state2",
            templateUrl: "partials/state2.list.html",
            controller: function($scope) {
                $scope.things = ["a", "set", "of", "things"];
            }
        })
});
Run Code Online (Sandbox Code Playgroud)

运行python 3的SimpleHttpServer,我404 error在尝试访问时得到:http://localhost:8000/state1234324324.

为什么没有$urlRouterProvider.otherwise("/state1");重定向所有未知路由/state1,根据这个问题,已经定义state …

html5 angularjs angular-ui-router

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

angular-ui-router ×2

angularjs ×2

html5 ×1