Angularjs路由ui-router配置

var app = angular.module("myApp", ['ui.router']);
    app.config(function ($stateProvider, $urlRouterProvider) {
        $urlRouterProvider.when("", "/home");
        $stateProvider
            .state("home", {
                url:"/home",
                views: {
                    "":{
                        templateUrl: 'view/home.html',
                        controller: 'homeCtrl'
                    },
                    "child":{templateUrl: 'view/home.html'}
                }
            })
            .state("about", {
                url:"/about",
                views: {
                    "":{
                        templateUrl: 'view/about.html',
                        controller: 'aboutCtrl'
                    },
                    "child":{templateUrl: 'view/about.html'}
                }

            })
    });

  

posted @ 2017-07-22 15:23  鱿鱼须须  阅读(286)  评论(0编辑  收藏  举报