1

I'm using angular ui router / stateProvider. However I set up my url any parts after the second forward slash is ignored and it always sends to this state:

  $stateProvider.state('board', {
    url: "/:board",
    views: {
      'content': {
        templateUrl: '/tmpl/board',
        controller: function($scope, $stateParams, $location) {
          console.log('wat')
          console.log($location)
        }
      }
    }
  });

Which has only 1 forward slash. Even when I go to localhost/contacts/asdf The following state doesn't run.

$stateProvider.state('test', { url: "/contacts/asdf", views: { 'main': { templateUrl: '/tmpl/contacts/asdf', controller: function () { console.log('this doesnt work here') } } } });

console ss This is a console log of $location. As you can see $location only recognizes the last part of the url as the path. As far as I can tell that's wrong. It's missing the "contacts" right before it. Any url is interpreted as having only 1 part for the url and sends to the board state. How do I fix this. THanks.

Edit: found that this was caused by angular 1.1.5. Reverting back to 1.1.4 didn't have this.

2 Answers 2

1

This may be the cause: https://github.com/angular/angular.js/issues/2799 . Try adding a base href.

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

Comments

0

Looks like that fixed in AngularJS v1.0.7. Just tested it.

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.