Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

ngRoute incorrectly handles route parameter on initial page load #3905

Closed
smashercosmo opened this issue Sep 6, 2013 · 5 comments
Closed

Comments

@smashercosmo
Copy link

Consider the following source code

angular
    .module('app', ['ngRoute'])
    .config(function($routeProvider){
        $routeProvider
           .when('/pages', {
        })
           .when('/pages/:page', {
        })
    });

If I load my app with initial url of "/pages/1" then it changes to "/pages/:page". Everything is fine with 1.1.5. Problem is only with 1.2 branch.

P.S. There are some troubles with plunker at the moment. Can't save working example.

@jamesdaily
Copy link
Contributor

Did you take this breaking change into account? (detailed in this commit description)

tl;dr: you now need to explicitly include ngRoute as a separate .js file and inject it into your app:

<script src="angular.js"></script>
<script src="angular-route.js"></script>
//[...]
var myApp = angular.module('myApp', ['ngRoute', 'someOtherModule']);

@smashercosmo
Copy link
Author

Yes, of course. In other cases router from 1.2.0-rc2 release works exactly the same as in previous 1.1.5 and earlier versions. The only issue i faced is the one i described. When you try to load page initially with named parameter. Just try it and you'll see.

@jamesdaily
Copy link
Contributor

Okay, just making sure! plunkr was taking forever to load for me earlier, too.

@petebacondarwin
Copy link
Contributor

This sounds like a regression although I haven't tried to reproduce it right now.

@smashercosmo
Copy link
Author

Ok, I made a regression testing on my app and found out that it wasn't an angular issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants