简体   繁体   中英

change code for angular-ui-router 2.0.13

I created this plnkr for show some code that i have to correct.

http://plnkr.co/edit/rlKFW2DIqzVSaWTt79u5?p=catalogue

I think i have to change the code inside stateProvider

validationApp.config(['$stateProvider', function ($stateProvider) {

With the latest version of ui-router(2.0.13) I can't see the login mask and the pages when I make the admin page when i make loginlogin. I'm working on ui-router v2.0.7 with no problems, but i want to correct my code for the latest version, someone can help me?

Not sure what is your issue, but at least here you can see the working versin of your plunker.

I changed the index.html

//<div ui-view="index"></div>
<div ui-view=""></div>

Also I added links to angular and ui-router... and it is working now.

This is the script.js snippet, which targets the unnamend view (not ui-view="index") - that's why I changed the index.html

validationApp = angular.module('validationApp', [
  'ui.router'
])

validationApp.config(['$urlRouterProvider', function ($urlRouterProvider) {

    $urlRouterProvider.when( '' ,  '/login' );

    $urlRouterProvider.when( '/admin' ,  '/admin/home');

}])

validationApp.config(['$stateProvider', function ($stateProvider) {
    $stateProvider
        .state('login', {
            url: '/login',
            //templateUrl: 'views/partials/login.html',
            templateUrl: 'login.html',
            controller: 'loginCtrl',
            authNotRequired:true
        })

Check it here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM