user2543670
user2543670

Reputation: 35

Issue with Routing on Ionic Hybrid app

I am new to Ionic and AngularJS. I seem to be struck with Routing. What am I doing wrong?

http://localhost:8100/#/home - works http://localhost:8100/#/app - does not work

On home.html, I have a static text "success!!". When I use the first url, I see the text. When I use the second one I get blank page.

Here is my code.

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

.run(function($ionicPlatform) {
  $ionicPlatform.ready(function() {
    if (window.cordova && window.cordova.plugins.Keyboard) {
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
    }
    if (window.StatusBar) {
      StatusBar.styleDefault();
    }
  });
})

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

    .state('home', {
        url: "/home",
        templateUrl: "app/home/home.html"
    })

    .state('app', {
        url: "/app",
        templateurl: "app/home/home.html"
    });

    $urlRouterProvider.otherwise('/app');
});

Upvotes: 0

Views: 75

Answers (1)

collardeau
collardeau

Reputation: 820

Take a closer look at you syntax. In the second state, you have "templateurl" and it should be camelCase: "templateUrl".

Upvotes: 1

Related Questions