Related to Angular Routes(single page application)

时间:2016-12-02 05:23:55

标签: angularjs twitter-bootstrap-3

Would like someone to help me in front end UI routing using angularjs? Am designing login & register setup but routing is not working perfectly and also bootstrap rendering does not render it properly when connected via MVC structure..

.

1 个答案:

答案 0 :(得分:0)

您可以使用UI-ROUTER在角度js中进行路由。

UI-Router应用程序被建模为状态的分层树。 UI-Router提供了一个状态机,以类似事务的方式管理这些应用程序状态之间的转换。

以下是路由配置示例

$stateProvider
    .state('register', {
        url: '/register',
        templateUrl: 'register.html',
        controller: 'registerController'
    })
    .state('login', {
        url: '/logn',
        templateUrl: 'login.html',
        controller: 'loginController'
    })
    .state('home', {
        url: '/home',
        templateUrl: 'partial-home.html'
    })
    // nested list with custom controller
    .state('home.list', {
        url: '/list',
        templateUrl: 'partial-home-list.html',
        controller: function($scope) {
            $scope.dogs = ['Bernese', 'Husky', 'Goldendoodle'];
        }
    })
    // nested list with just some random string data
    .state('home.paragraph', {
        url: '/paragraph',
        template: 'I could sure use a drink right now.'
})

Github link for documentation

Another reference for ui-router

A Demo for routing and navigation using ui-router