Skip to content

improved parameters and independent sibling views #422

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

Closed
FAQinghere opened this issue Sep 15, 2013 · 2 comments
Closed

improved parameters and independent sibling views #422

FAQinghere opened this issue Sep 15, 2013 · 2 comments
Labels

Comments

@FAQinghere
Copy link

The stock Angular router passes all search parameters through, not just those that were predefined. It also allows changing (search) parameters without reloading the 'state.' Together, this allows for independence of (search) parameters, and some really interesting implementations accordingly.

The angular-ui router could, with one tweak, have an awesome jump in functionality.

The current nesting of parent/child states is excellent. But what is missed is that we ALMOST have nested sibling views too, but not quite.

Use case:
Imagine we have a search box and list of results in the left column of some state. Maybe it's a list of users, for example. On the right hand side we have the currently selected record's details (the user details in this example, and maybe scrolled down a bit).

Ideally, we could modify the search parameters, reloading the left column (sub-state) without affecting the sibling right column substate (maybe we've scrolled down the selected user's details column, and don't want to lose that position. Likewise, we could click on another user in the list, loading that users details in the right substate, without affecting the left substate (the list - we don't want to lose the position we've scrolled to, or bother with reloading data or rebuilding views that are already in place).

We could kill several birds with one stone if we can flag parameters as passive.

Example.

'/users/:subsection/::leftcol/::id'

All parameters are used to define the state, but only the active :parameters force a reload of the whole state. The passive ::parameters do not cause a reload of the whole state (remember - this 'whole' state might be the child of another - it's not necessary the top most level), but substates can follow those passive parameters to reload their particular sub views.

We already have most of the infrastructure. We can use the current subviews as substates, just by marking which passive parameters that substate tracks:

.when('/users/:subsection/::substateParam1/::substateParam2', {
    someSubView: {
        controller: 'SubViewController',
        templateUrl: '/subViewController.hmtl',
        tracks: ['substateParam1'] // default would be tracks all - i.e. any param change causes reload
    },
    someSubviewTwo: {
        controller: 'SubViewController',
        templateUrl: '/subViewController2.hmtl',
        tracks: ['substateParam2']

    }
})����

Like this sub views/sub states would function completely independently. It would also dovetail in nicely with optional parameters.

Any thoughts?

@nateabele
Copy link
Contributor

At least part of this is coming in #454.

@timkindberg
Copy link
Contributor

Closing, too old. Check out #1032 coming in 0.3.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants