离子导航视图不渲染模板

时间:2017-01-22 18:56:34

标签: ionic-framework

我开始使用离子骨架。 我有一些问题, 我想我已经完成了所有需要的事情 inn 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>

当我看到萤火虫时,我可以看到答案,但离子导航视图不会渲染主页中定义的离子视图

1 个答案:

答案 0 :(得分:0)

加载视图时,必须使用url属性中设置的属性,而不是模板的路径。因此,您必须更改/home.html的{​​{1}}。

/home