Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex 在Angularjs UI路由器中,如何使用条件检查URL?_Regex_Url_Numbers_Integer - Fatal编程技术网

Regex 在Angularjs UI路由器中,如何使用条件检查URL?

Regex 在Angularjs UI路由器中,如何使用条件检查URL?,regex,url,numbers,integer,Regex,Url,Numbers,Integer,现在我的路线文件中有了这段代码 $stateProvider. state('home', { url: '/', templateUrl: 'modules/core/views/home.client.view.html' }). state('thread', { url: '/:thread_id', templateUrl: 'modules/core/views/thread.client.view.html' }). state('privacy',

现在我的路线文件中有了这段代码

$stateProvider.
state('home', {
    url: '/',
    templateUrl: 'modules/core/views/home.client.view.html'
}).
state('thread', {
    url: '/:thread_id',
    templateUrl: 'modules/core/views/thread.client.view.html'
}).
state('privacy', {
    url: '/privacy',
    templateUrl: 'modules/core/views/privacy.client.view.html'
}).
state('terms', {
    url: '/privacy',
    templateUrl: 'modules/core/views/terms.client.view.html'
});
我的目标是:当thread_id为纯整数时,它将导航到thread.client.view.html。否则,它会导航到其他页面,如隐私、条款等

这有可能实现吗?

终于实现了

state('thread', {
    url: '/{thread_id:[0-9]{0,100}}',
    templateUrl: 'modules/core/views/thread.client.view.html'
}).
参考:Regex参数