Skip to content

Commit deea695

Browse files
fix($state): change $state.href default options.inherit to true
Merge branch 'pr-1110'
2 parents 547d61f + 8dda6ab commit deea695

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/state.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1091,7 +1091,7 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) {
10911091
* - **`lossy`** - {boolean=true} - If true, and if there is no url associated with the state provided in the
10921092
* first parameter, then the constructed href url will be built from the first navigable ancestor (aka
10931093
* ancestor with a valid url).
1094-
* - **`inherit`** - {boolean=false}, If `true` will inherit url parameters from current url.
1094+
* - **`inherit`** - {boolean=true}, If `true` will inherit url parameters from current url.
10951095
* - **`relative`** - {object=$state.$current}, When transitioning with relative path (e.g '^'),
10961096
* defines which state to be relative from.
10971097
* - **`absolute`** - {boolean=false}, If true will generate an absolute url, e.g. "http://www.example.com/fullurl".
@@ -1101,7 +1101,7 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) {
11011101
$state.href = function href(stateOrName, params, options) {
11021102
options = extend({
11031103
lossy: true,
1104-
inherit: false,
1104+
inherit: true,
11051105
absolute: false,
11061106
relative: $state.$current
11071107
}, options || {});

test/stateSpec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ describe('state', function () {
649649

650650
it('inherit url parameters from current url', inject(function ($state) {
651651
initStateTo($state.get('root'), {param1: 1});
652-
expect($state.href("root", {}, {})).toEqual("#/root");
652+
expect($state.href("root", {}, {})).toEqual("#/root?param1=1");
653653
expect($state.href("root", {}, {inherit:false})).toEqual("#/root");
654654
expect($state.href("root", {}, {inherit:true})).toEqual("#/root?param1=1");
655655
}));

0 commit comments

Comments
 (0)