angular-ui-router 页码参数
示例
类似于,int但仅接受正整数(当有page参数时,可用于分页。
定义:
module.config(['$urlMatcherFactoryProvider', function($urlMatcherFactory) {
$urlMatcherFactory.type('page', {
decode: function(val) { return +val; },
encode: function(val) { return Math.floor(val); },
equals: function(a, b) { return this.is(a) && +a == +b; },
is: function(val) { return angular.isNumber(val) && val >= 1; },
pattern: /\d+/
})
}]);并使用:
$stateProvider.state({
url: '/my-route/{page:page}'
template: '<my-page></my-page>'
});柱塞和相关的答案。
热门推荐
10 朋友新年祝福语大全 简短
11 新年祝福语简短大方兔年
12 搬新家礼物祝福语简短
13 同学见面花束祝福语简短
14 五一假期祝福语幽默简短
15 离职欢送敬酒祝福语简短
16 对学弟的祝福语简短
17 考老师辞职祝福语简短
18 祝福语驱散霉运的话简短