Ionic routing doesn't work


#1

Hello! There is the following html code:

doctype html
html ng-app="app"
	head lang="en"
		meta charset="utf-8"
		meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"
		title First phonegap application
		link href="bower_components/ionic/release/css/ionic.min.css" rel="stylesheet"
		script src="bower_components/ionic/release/js/ionic.bundle.min.js"
	body
		ion-header-bar
			h1.title
				| Header
		ion-content
			ion-nav-view
		ion-footer-bar
			h1.title
				| Footer
		script id="home.html" type="text/ng-template"
			ion-view view-title="Home"
				ion-content class="padding"
					p
						| 123
		script src="js/main.js"
		script src="cordova.js"

And the following Angular main module file:

angular.module("app", ["ionic"]).config([
  "$stateProvider", function($stateProvider) {
    return $stateProvider.state("home", {
      url: "/",
      templateUrl: "home.html",
      controller: "HomeController"
    });
  }
]).controller("HomeController", [
  "$scope", "$state", function($scope, $state) {
    return console.log(111);
  }
]);

Problem is the following one: when I try to open index.html my application doesn’t render ‘home.html’ template. What I do wrong? Thanks in advance!


#2

Hi there,

the ‘return’ in front of the $stateProvider. Don’t think that is required. Try remove the ‘return’


#3

Yep, .config doesnt require a return.