8

ui-router's version 0.2.11 introduced option to turn off strict URL matching, but I can't figure out how to actually use it.

I've tried standard config as they use in tests:

app.config(function ($urlMatcherFactoryProvider) {
  $urlMatcherFactoryProvider.caseInsensitive(true);
  $urlMatcherFactoryProvider.strictMode(false);
});

None of those settings work, so I guess I'm either doing something wrong or it's bugged. There's also seem to be no documentation about it.

2
  • Is there an equivalent github issue open? (I can't seem to get this to work either) Commented Oct 22, 2014 at 17:44
  • 2
    @Nate github.com/angular-ui/ui-router/issues/1395 It should be fixed in master. I'm waiting for next release to test it. Commented Nov 3, 2014 at 19:24

2 Answers 2

8

I believe this was fixed in 0.2.12.

That said, I ran into this problem in 0.2.15. It turns out that you need to configure the $urlMatcherFactoryProvider BEFORE the $stateProvider.

i.e. the following code will NOT work:

$stateProvider.state('login', {
    url: "/login",
    templateUrl: 'templates/login.html',
    controller: 'loginController as loginCtrl'
});
$urlMatcherFactoryProvider.caseInsensitive(true);
$urlMatcherFactoryProvider.strictMode(false);

You have to configure the $urlMatcherFactoryProvider first, like this:

$urlMatcherFactoryProvider.caseInsensitive(true);
$urlMatcherFactoryProvider.strictMode(false); 
$stateProvider.state('login', {
    url: "/login",
    templateUrl: 'templates/login.html',
    controller: 'loginController as loginCtrl'
});
Sign up to request clarification or add additional context in comments.

5 Comments

Using Ui Router 0.2.15 & AngularJS v1.4.7, this does not work.
@mcranston18 This works with angular-ui-router 0.2.15 and AngularJS 1.4.5. I doubt that it would have broken in 1.4.7, so check to see if there is something else you are missing.
Sorry for late answer. It seems it was really fixed. However, there seems to be a new bug which prevents me to configure $urlMatcherFactoryProvider in root module. As a workaround I'm setting it in first child module that's required by the root one.
In the end it might be the same scenario you describe.
@OndrejSlinták No worries about the late response - I was mostly posting this for the benefit of people like me who had the same problem. I appreciate the answer though :). However, I'm not experiencing the same bug you are with the root module. There might be something else going on.
-6

use like this

app.config(["$routeProvider", "$locationProvider",
    function ($routeProvider, $locationProvider) {
        return $routeProvider.when("/", {
            redirectTo: "/signin"
        })
        .when("/dashboard", {
            templateUrl: "App/views/Dashboard/dashboard.html",

        }).when("/signup", {
            templateUrl: "App/views/signup/signup.html",
            resolve: {
                permission: function (authorizationService, $route) {
                    return authorizationService.permissionCheck("signup");
                },
            }
        })
.when("/myAccount", {
            templateUrl: "App/views/myAccount/myAccount.html",
            resolve: {
                permission: function (authorizationService, $route) {
                    return authorizationService.permissionCheck("myAccount");
                },
            }
        })
        .when("/signin", {
            templateUrl: "App/views/signin/signin.html",
            resolve: {
                permission: function (authorizationService, $route) {
                    return authorizationService.permissionCheck("SKIP");
                },
            }
        })

1 Comment

This answer uses angular-route, but the question is related to angular-ui-router.

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.