0
votes

I'm begining with ionic framework. I've got some problem, I think I've already done all thing needed well 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");
        });

in 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>

in home.html

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

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

when I look at the firebug, I can see the answer but the ion-nav-view doen't render the ion-view defined in home page

1

1 Answers

0
votes

When loading a view, you have to use the property set in the url property, not the path of the template. SO you have to change /home.html for /home.

   $urlRouterProvider.otherwise("/home");