Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

273
Views
How to hide some params in URL with AngularJS UI Router?

I wanted to define a route that received one mandatory param and another optional param that would be hidden in the URL. It would be something like:

http://www.myapp.com/viewingPodcast/4

and the hidden param still available but not shown in the URL.

I am using ng-href + $state.href to get the url. I also have looked at this answer and it's comments but I still couldn't get it to work with my version.

This is my state config


.state("viewingPodcast", {
          ...
          url: "/podcast/:id",
          controller: "podcastCtrl",
          templateUrl: ...,
          params: { zineId: null },
          data: {
           ...
          },
          resolve: {
            ...
          },
        })

And the $state.href:

...
$state.href("viewingPodcast", { id: content.id, zineId: content.zineId });
...

Both values (id and zineId) are not nulled when debugging the $state.href line. I tried, like mentioned in the comments of the answer above:

$state.href("viewingPodcast", { id: content.id, zineId: { zineId: content.zineId } });

but when entering the controller and checking the params (with $state.params.zineId) the value is null.

I don't know if I'm doing something wrong and I still can't comment to ask on the other answer so I'm stuck creating a new question.

Thanks in advance

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!