Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor StateParameter extraction #21

Open
jeme opened this issue May 16, 2013 · 0 comments
Open

Refactor StateParameter extraction #21

jeme opened this issue May 16, 2013 · 0 comments
Milestone

Comments

@jeme
Copy link
Contributor

jeme commented May 16, 2013

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 || {});
    }
@jeme jeme modified the milestones: Future, 0.6.3 Apr 22, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant