2

I have an URL http://sitename.com/#/products/manage-options/31?form_id=32&type=create-template

Here above my URL I want to remove type but below my code not working properly. Please Check

My Current page URL - http://sitename.com/#/products/manage-options/31?type=create-template

<a href="" ng-click="clickMe();">Click Here</a>

$scope.clickMe = function(){
  $location.search('type', null);
  $state.go('products.manage_options', ({form_id: $stateParams.form_id}));
};

After page redirecting I saw type QueryString not removed.

My output is - http://sitename.com/#/products/manage-options/31?form_id=32&type=create-template I want http://sitename.com/#/products/manage-options/31?form_id=32

please help me.

EDIT:

Router

.state('products.manage_options', {
        url: '/manage-options/:product_id?form_id=&type',
        templateUrl: "views/product/manage_options.html",
        controller: "manageAttributeCtrl",
        data: {pageTitle: 'Manage Options'},
})
3
  • what is the URL target of your state 'products.manage_options' ? Commented Sep 28, 2016 at 5:25
  • @JuniorDev I have updated my code. Commented Sep 28, 2016 at 5:26
  • Might be worth to specify ({form_id: $stateParams.form_id}, {type: ''}) @Chinu Commented Sep 28, 2016 at 5:39

2 Answers 2

4

Remove

$location.search('type', null);

Change following line :

$state.go('products.manage_options', ({form_id: $stateParams.form_id, type:null}));
Sign up to request clarification or add additional context in comments.

Comments

1

see documentation https://docs.angularjs.org/api/ng/service/$location#search

     $state.go('products.manage_options', ({form_id: $stateParams.form_id, type:null}));

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.