2015-03-22 4 views
1

У меня проблемы с ионным/угловым. Я новичок в ионной и нуждаюсь в некоторой помощи. Большая часть материала в Интернете - для заставки, поэтому я приехал сюда для дальнейшей помощи.

Я хочу, чтобы приложение не размещалось по умолчанию на странице приветствия. Что мне нужно написать? Мой код выглядит следующим образом.

angular.module('starter', ['ionic', 'starter.controllers']) 

.run(function($ionicPlatform) { 
    $ionicPlatform.ready(function() { 
    // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard 
     // for form inputs) 
    if (window.cordova && window.cordova.plugins.Keyboard) { 
     cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true); 
    } 
    if (window.StatusBar) { 
     // org.apache.cordova.statusbar required 
     StatusBar.styleDefault(); 
    } 
    }); 
}) 

.config(function($stateProvider, $urlRouterProvider) { 
    $stateProvider 

    .state('app', { 
    url: "/app", 
    abstract: true, 
    templateUrl: "templates/menu.html", 
    controller: 'AppCtrl' 
    }) 

    .state('app.welcome', { 
    url: "/welcome", 
    views: { 
     'menuContent': { 
     templateUrl: "templates/welcome.html" 
     } 
    } 
    }) 

    .state('app.bulletin', { 
    url: "/bulletin", 
    views: { 
     'menuContent': { 
     templateUrl: "templates/bulletin.html" 
     } 
    } 
    }) 
    .state('app.lunch', { 
    url: "/lunch", 
    views: { 
     'menuContent': { 
     templateUrl: "templates/lunch.html" 
     } 
    } 
    }) 
    }); 
    // if none of the above states are matched, use this as the fallback 
    $urlRouterProvider.otherwise("/app/welcome"); 
}); 

ответ

1

Думаю, вам нужно удалить}); выше $ urlRouterProvider, так как вам нужно определить иначе() внутри конфига;

app.config(function($urlRouterProvider){ 
    // if the path doesn't match any of the urls you configured 
    // otherwise will take care of routing the user to the specified url 
    $urlRouterProvider.otherwise('/index'); 
}) 
+0

Это решило мою проблему. Спасибо за ваше понимание. – wilsonhobbs

Смежные вопросы