1

index.html:

<!doctype html>
<html ng-app ng-csp>
  <head>
    <meta charset="UTF-8">
    <title>Presently</title>
    <link rel="stylesheet" href="app/styles/angular-csp.css">
    <!--<link rel="stylesheet" href="css/main.css">-->

    <script src="assets/dependencies/angular/angular.min.js"></script>
    <script src="assets/dependencies/angular-ui-router/release/angular-ui-router.js"></script>

    <script src="main.js"></script>

    <script src="app/states/home/home.controller.js"></script>
    <script src="app/states/home/favs/fav.controller.js"></script>
  </head>
  <body>
    hello {{'foo'.length}}

    <div ui-view></div>
  </body>
</html>

main.js:

console.log('main.js');

var myApp = angular.module('myApp', ['ui.router'])
.config(['$stateProvider', '$urlRouteProvider'
  , function($stateProvider, $urlRouterProvider) {
  $urlRouterProvider.otherwise("/");

  $stateProvider
    .state('state1', {
      url: "/",
      template: "home"
    });
}]);

console.log(myApp);

So the console logs show for main.js and the app but nothing is rendered in the view. I would expect to see the word 'home'

2
  • Never used template as a string like this, only templateUrl = "/path/to/template.html ... is it working if you switch to it? (aka at least making a get request to templateUrl? ) Commented Apr 4, 2015 at 15:34
  • Which version of angular u r using ? Commented Apr 4, 2015 at 16:19

1 Answer 1

1

You had a typo ($urlRouteProvider instead of the $urlRouterProvider)

.config(['$stateProvider', '$urlRouteProvider'
, function($stateProvider, $urlRouterProvider) {

Which I fixed here in this working plunker

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

Check the Router in the $urlRouterProvider

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

1 Comment

Well, great that we made it. Enjoy awesome UI-Router sir ;)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.