systemdebt
systemdebt

Reputation: 4951

ui router not working without any errors

app.js:

'use strict';

/**
 * @ngdoc overview
 * @name App
 * @description
 * # App
 *
 * Main module of the application.
 */
angular
  .module('App', [
    'ngAnimate',
    'ngCookies',
    'ngRoute',
    'ngResource',
    'ngSanitize',
    'ngTouch',
    'ngMaterial',
    "ui.router"
  ])
  .config(['$urlRouterProvider', '$stateProvider', function ($urlRouterProvider, $stateProvider) {

    $stateProvider
      .state('home', {
        url: '/',
        templateUrl: 'views/home.html',
        controller: 'HomeCtrl'
      })
  }
  ]
);

index.html:

 <body ng-app="App">
 <header></header>
 <div ui-view="">
 </div>
 <footer></footer>
 </body>

There are no errors in the console. I have tried ngRouter and that seems to work but uiRouter is just not working and I am not able to see why.

I have tried using already.

Upvotes: 0

Views: 30

Answers (1)

Sajeetharan
Sajeetharan

Reputation: 222722

It should be App instead of webocityReviewApp

 <body ng-app="App">

EDIT

Try with a state "/"

app.config(function($stateProvider, $urlRouterProvider) {
 $urlRouterProvider.when("", "/");
  $stateProvider
    .state('root', {
      url: '/',
      templateUrl: "home.html",
      controller: 'HomeCtrl'

    })
    .state('root.master1', {
      url: '/master1',
      templateUrl: "master1.html",
      controller: 'master1Ctrl'

    })
    .state('root.master2', {
      url: '/master2',
      templateUrl: "master2.html",
      controller: 'master2Ctrl'
    })
})

DEMO

Upvotes: 1

Related Questions