ui-router 可以在 AngularJS 中处理多个参数吗? [英] Can ui-router handle multiple parameters in AngularJS?

查看:13
本文介绍了ui-router 可以在 AngularJS 中处理多个参数吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,该应用程序当前构建为具有最后带有参数的静态基本 URL.我希望将基本 URL 默认设置为一个值,但能够基于多个选项构建路由.所以现在它设置为:

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'
      }
    }
  });

静态球值是我想要改变的.基本上我想有一个可选的传入 URL 列表,但是当没有任何东西存在时,它默认为球.例如:

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:

球/页面标题

蝙蝠/页面标题

篮子/页面标题

野兽/页面标题

这些都可以,并且在构建 URL 时它会默认为 ball/

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.

推荐答案

我不认为我在这里问的问题实际上可以在没有其他参数问题的情况下完成.相反,我从传入的链接中询问了一个关于 Regex 的新问题,以重新路由到我的 angular URL.

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.

这篇关于ui-router 可以在 AngularJS 中处理多个参数吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆