Skip to content

Commit

Permalink
Merge pull request #1404 from coma/issue-1397
Browse files Browse the repository at this point in the history
Impossible to disable html5Mode with angular 1.3.0-rc.3 #1397
  • Loading branch information
nateabele committed Sep 26, 2014
2 parents 47c6167 + 7fea1e9 commit 9837c09
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/urlRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,10 @@ function $UrlRouterProvider( $locationProvider, $urlMatcherFactory) {
if (!urlMatcher.validates(params)) return null;

var isHtml5 = $locationProvider.html5Mode();
if (angular.isObject(isHtml5)) {
isHtml5 = isHtml5.enabled;
}

var url = urlMatcher.format(params);
options = options || {};

Expand Down
14 changes: 12 additions & 2 deletions test/urlRouterSpec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
describe("UrlRouter", function () {

var $urp, $ur, location, match, scope;
var $urp, $lp, $ur, location, match, scope;

describe("provider", function () {

Expand Down Expand Up @@ -46,8 +46,9 @@ describe("UrlRouter", function () {
describe("service", function() {

beforeEach(function() {
angular.module('ui.router.router.test', function() {}).config(function ($urlRouterProvider) {
angular.module('ui.router.router.test', function() {}).config(function ($urlRouterProvider, $locationProvider) {
$urp = $urlRouterProvider;
$lp = $locationProvider;

$urp.rule(function ($injector, $location) {
var path = $location.path();
Expand Down Expand Up @@ -198,6 +199,15 @@ describe("UrlRouter", function () {
expect($urlRouter.href(matcher, { param: 1138 })).toBe('#/foo/1138');
expect($urlRouter.href(matcher, { param: 5 })).toBeNull();
}));

it('should handle the new html5Mode object config from Angular 1.3', inject(function($urlRouter) {

$lp.html5Mode({
enabled: false
});

expect($urlRouter.href(new UrlMatcher('/hello'))).toBe('#/hello');
}));
});
});

Expand Down

0 comments on commit 9837c09

Please sign in to comment.