You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since Object.assign only makes copies of the stateDeclaration's own properties, it does not make copies of the prototype onEnter function, for example.
We should switch back to the old behavior (internal state object's prototype is the user supplied state declaration). We will lose the ability to do obj instanceof State, but that is a small price to enable numerous other convenient features.
For example, hook functions can check for user-supplied state properties without explicitly querying state.self.property:
Projects like sticky states can define new callbacks (like onInactivate) without also creating a statebuilder to enable access to the stateDeclaration.onInactivate property.
The text was updated successfully, but these errors were encountered:
In angular-ui-router 0.x you could create a class for a state:
This worked fine back then because the internal
State
object's prototype was the user suppliedStateDeclaration
, i.e,but this is no longer possible because we now use
new State()
to get theState
(class) prototype, i.e.,Since Object.assign only makes copies of the stateDeclaration's own properties, it does not make copies of the prototype
onEnter
function, for example.We should switch back to the old behavior (internal state object's prototype is the user supplied state declaration). We will lose the ability to do
obj instanceof State
, but that is a small price to enable numerous other convenient features.For example, hook functions can check for user-supplied state properties without explicitly querying
state.self.property
:Projects like sticky states can define new callbacks (like
onInactivate
) without also creating a statebuilder to enable access to thestateDeclaration.onInactivate
property.The text was updated successfully, but these errors were encountered: