0

I have an app that is currently built to have a static base URL with a parameter at the end. I would like to instead have the base URL default to one vaule, but have the ability to built routes based on several options. So for now its set up as:

  .state('ball', {
    parent: 'ballLayout',
    url: '/ball/{urlName}',
    views: {
      'cube.head': {
        templateUrl: 'partials/views/ball.head.html',
        controller: 'BallCtrl'
      }
    }
  });

The static ball value is what I'd like to change. Basically I'd like to have an optional list of incoming URLs that would work, but when nothing is present it defaults to ball. So for instance:

ball/title-of-page

bat/title-of-page

basket/title-of-page

beast/title-of-page

These would all work, and when constructing the URL it would default to ball/

Is something like this possible? How would one go about implementation.

3
  • Of course, you can use multiple stateparams to build your url. Have you tried using url: '/{something}/{urlName}', instead of url: '/ball/{urlName}'? Commented May 30, 2014 at 18:03
  • yep, my concern was just that it leaves the URL to be open to anything. So if an external url comes in that is say apples/title-of-page it would still work. I'd want to make sure it only gave the URL if it met one of this 4. If that makes sense. Maybe if it doesnt it would just redirect or 404. Commented May 30, 2014 at 18:17
  • In fact the more that I look at it the more i see an issue. If its on the base URL of / and I'm passing a param right after that then it will conflict with any other routes I have. So its almost like I need the option of 4 static base routes for this one $state. Can this be done? Commented May 30, 2014 at 18:47

1 Answer 1

0

I dont think what I'm asking here can actually be done without having issues with other parameters. Instead Im asking a new question about Regex from incoming links to reroute to my angular URL.

Sign up to request clarification or add additional context in comments.

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.