diff --git a/src/state.js b/src/state.js index 7076cc0ab..be36c99bc 100644 --- a/src/state.js +++ b/src/state.js @@ -41,7 +41,7 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) { // inherit 'data' from parent and override by own values (if any) data: function(state) { if (state.parent && state.parent.data) { - state.data = state.self.data = extend({}, state.parent.data, state.data); + state.data = state.self.data = inherit(state.parent.data, state.data); } return state.data; }, diff --git a/test/stateSpec.js b/test/stateSpec.js index a8f45ac4a..7249895bf 100644 --- a/test/stateSpec.js +++ b/test/stateSpec.js @@ -1338,6 +1338,7 @@ describe('state', function () { expect($state.current.name).toEqual('HHH'); expect($state.current.data.propA).toEqual(HHH.data.propA); expect($state.current.data.propB).toEqual(H.data.propB); + expect($state.current.data.hasOwnProperty('propB')).toBe(false); expect($state.current.data.propB).toEqual(HH.data.propB); expect($state.current.data.propC).toEqual(HHH.data.propC); }));