2016-12-14 3 views
1

Я начал изучать Ионный. Я связываю, чтобы установить маршрут по умолчанию на мой home.html, но он не работает.Установите представление по умолчанию в Ionic AngularJS

index.html

<ion-header-bar align-title="left" class="bar-positive"> 
     <div class="buttons"> 
     <button class="button icon ion-navicon"></button> 
     </div> 
     <h1 class="title" style="text-align: center;">Title!</h1> 
     <div class="buttons"> 
     <button class="button icon ion-home"></button> 
     </div> 
    </ion-header-bar> 
    <ion-nav-view></ion-nav-view> 

home.html

<h1>Hello world!</h1> 

app.js

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

     .state('home', { 
     url: '/', 
     views: { 
      'login': { 
      templateUrl: 'templates/home.html', 
      controller: 'PlaylistsCtrl' 
      } 
     } 
     }) 
    // if none of the above states are matched, use this as the fallback 
    $urlRouterProvider.otherwise('/'); 
    }); 

помочь мне, где я делать неправильно.

+0

Try '$ urlRouterProvider.otherwise ('/ дом');' –

ответ

1

Я думаю, вы должны изменить URL из дома

.state('home', { 
     url: '/home', 
     views: { 
      'login': { 
      templateUrl: 'templates/home.html', 
      controller: 'PlaylistsCtrl' 
      } 
     } 
     }) 
    // if none of the above states are matched, use this as the fallback 
    $urlRouterProvider.otherwise('/home');