2017-01-22 31 views
0

我开始与离子框架。 我有一些问题, 我觉得我已经做了好所需的所有东西 客栈app.js离子导航视图不呈现模板

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

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

        // Don't remove this line unless you know what you are doing. It stops the viewport 
        // from snapping when text inputs are focused. Ionic handles this internally for 
        // a much nicer keyboard experience. 
        cordova.plugins.Keyboard.disableScroll(true); 
       } 
       if (window.StatusBar) { 
        StatusBar.styleDefault(); 
       } 
      }); 
     }) 

     .config(function ($stateProvider, $urlRouterProvider) { 
      $stateProvider.state('home', { 
       url: '/home', 
       templateUrl: 'views/home.html' 
      }).state('about', { 
       url: '/about', 
       templateUrl: 'views/about.html' 
      }); 

      $urlRouterProvider.otherwise("/home.html"); 
     }); 

中的index.xhtml

<body ng-app="starter"> 
<!--<ion-nav-bar class="bar-positive"></ion-nav-bar>--> 
<ion-nav-bar class="bar-positive"> 
    <ion-nav-back-button> 
    </ion-nav-back-button> 
</ion-nav-bar> 

<ion-nav-view></ion-nav-view> 

在home.html的

<ion-view view-title="home"> 
<ion-content> 
    <p> 
     <a ui-sref="about">About</a> 
    </p> 

</ion-content></ion-view> 

当我看着萤火虫时,我可以看到答案,但ion-nav-view不会呈现在主页

01中定义的离子视图

回答

0

加载视图时,必须使用url属性中设置的属性,而不是模板的路径。所以你必须改变/home.html/home

$urlRouterProvider.otherwise("/home"); 
0

感谢你为这个回调,但它并没有解决问题,