Skip to content

Commit

Permalink
fix($state): change $state.href default options.inherit to true
Browse files Browse the repository at this point in the history
Merge branch 'pr-1110'
  • Loading branch information
christopherthielen committed Aug 27, 2014
2 parents 547d61f + 8dda6ab commit deea695
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -1091,7 +1091,7 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) {
* - **`lossy`** - {boolean=true} - If true, and if there is no url associated with the state provided in the
* first parameter, then the constructed href url will be built from the first navigable ancestor (aka
* ancestor with a valid url).
* - **`inherit`** - {boolean=false}, If `true` will inherit url parameters from current url.
* - **`inherit`** - {boolean=true}, If `true` will inherit url parameters from current url.
* - **`relative`** - {object=$state.$current}, When transitioning with relative path (e.g '^'),
* defines which state to be relative from.
* - **`absolute`** - {boolean=false}, If true will generate an absolute url, e.g. "http://www.example.com/fullurl".
Expand All @@ -1101,7 +1101,7 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) {
$state.href = function href(stateOrName, params, options) {
options = extend({
lossy: true,
inherit: false,
inherit: true,
absolute: false,
relative: $state.$current
}, options || {});
Expand Down
2 changes: 1 addition & 1 deletion test/stateSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ describe('state', function () {

it('inherit url parameters from current url', inject(function ($state) {
initStateTo($state.get('root'), {param1: 1});
expect($state.href("root", {}, {})).toEqual("#/root");
expect($state.href("root", {}, {})).toEqual("#/root?param1=1");
expect($state.href("root", {}, {inherit:false})).toEqual("#/root");
expect($state.href("root", {}, {inherit:true})).toEqual("#/root?param1=1");
}));
Expand Down

0 comments on commit deea695

Please sign in to comment.