This is a thought for now, but we have some dupelicate code that extracts parameters from states it is however not 100% the same code, but similar enough to make for a single function doing so.
This is currently done in 3 places.
something in lines of:
function extractStateParams(state, params?) {
var currentState = $state.current,
currentParams = (currentState && currentState.$params && currentState.$params.all),
stateParams = {};
forEach(state.route.params, (param, name) => {
if (name in currentParams)
stateParams[name] = currentParams[name];
});
return extend(stateParams, params || {});
}
This is a thought for now, but we have some dupelicate code that extracts parameters from states it is however not 100% the same code, but similar enough to make for a single function doing so.
This is currently done in 3 places.
something in lines of: