Skip to content

ui-sref override params #703

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
pfried opened this issue Dec 19, 2013 · 1 comment
Closed

ui-sref override params #703

pfried opened this issue Dec 19, 2013 · 1 comment

Comments

@pfried
Copy link

pfried commented Dec 19, 2013

I have the following problem:

I have a state which may has a parameter called view which results in a subset of items in a list, if the param is not set it will show all items

so i do have one url which is items which can also be items?view=1

.state('items', {
    url : '/items?view',
    views: {
        "mainPanel" : {
            templateUrl : 'directives/items.html',
            controller : function($scope, $stateParams) {
                $scope.viewId = $stateParams.view;
            }
        }
    }
})

I know have a navigation which i create from the database

ul.nav
  li(ui-sref-active="active")
    a(ui-sref="'items'") All items
  li(ng-repeat="view in views", ui-sref-active="active")
    a(ui-sref="items({ 'view' :  {{ view.id }} })") {{ view.name }}

The problem now is if i got to a view with the view param set the ui-sref path for All items has also the param as i cannot set it to null.

I could set it in the all route by using { 'view' : null } but this would make the route ugly and is not the desired behaviour.

Any idea how to reset the state params or how to provide a solution to this? I would like to have a way like ui-sref="'items({})'"for resetting the params, otherwise i would have to use hreffor now and loose the comfort of ui-sref-active

@pfried
Copy link
Author

pfried commented Dec 19, 2013

duplicate #376

@pfried pfried closed this as completed Dec 19, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant