3

router working within my Angular JS app. My code is:

Script:

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js"></script>
<script src="bower_components/angular-ui-router/release/angular-ui-router.min.js"></script>

HTML:

<div ui-view></div>

app.js:

var myApp = angular.module('myApp', ['ui-router','mainControl','ui.bootstrap', 'ngSanitize']);
myApp.config(function($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise('/splash');
  //
  // Now set up the states
  $stateProvider
    .state('splash', {
      url: '/splash',
      templateUrl: 'partials/splash2.html',
      controller: 'MainControl'
    })
    .state('advice', {
      url: '/advice',
      templateUrl: 'partials/advice.html',
      controller: 'MainControl'
    })
    .state('main', {
      url: '/main',
      templateUrl: 'partials/main.html',
      controller: 'MainControl'
    })
    });

I was has successfully integrated ngRoute into my project, but for some reason the routing was not working in Safari and IE, So this is why I am now trying to integrate the UI-router into my project so that I can successfully get the routing working within my Application.

Any help would be appreciated.

3
  • What do you mean by "not working"? Both ngRouter and uiRouter work on all browsers. Which error stack are you getting? At first sight your code looks ok. Why do you use the same controller on all your routes? Commented Sep 1, 2015 at 11:00
  • ngRouter and uiRouter now work in Chrome and Firefox, but the app just does not work in IE and safari? Commented Sep 1, 2015 at 11:04
  • Any error in the console? Commented Sep 1, 2015 at 11:04

2 Answers 2

5

You are having typo, module name should be ui.router instead of ui-router while creating myApp module for your app.

Sign up to request clarification or add additional context in comments.

1 Comment

@Sole Glad to help you THanks :)
1

Besides ui.router, you should add the js file for ngSanitize (<script src="angular-sanitize.js">)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.