0

I am having trouble with my Angular JS ui-router and every question I have found on here shows a solutions I have already tried.

In my ui-view-tag my actual template is not displayed.

<body ng-app="myApp">
<div class="row">
  <div class="col-md-6 col-md-offset-2">
    <ui-view></ui-view>
  </div>
</div>
</body>

This is my app.js

angular.module('myApp', ['ui.router'])
 .config(['$stateProvider', '$urlRouterProvider',
   function($stateProvider, $urlRouterProvider) {

$stateProvider
.state('home', {
    url: '/',
    templateUrl: 'home.html',
    controller: 'MainCtrl'
})

   $urlRouterProvider.otherwise('home');
}])

Thank you very much everybody, I would really appreciate a short feedback on that.

2
  • any message from the console? Commented Jul 27, 2016 at 0:46
  • no nothing unfortunately Commented Jul 27, 2016 at 0:46

1 Answer 1

1

The $urlRouterProvider otherwise() accepts the url path you want to redirect to. Therefore, you need to change:

$urlRouterProvider.otherwise('home');

To:

$urlRouterProvider.otherwise('/');
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you! Let me try that.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.