布尔参数

限定:

module.config(['$urlMatcherFactoryProvider', function($urlMatcherFactory) {
  $urlMatcherFactory.type('boolean', {
    decode: function(val) { return val == true || val == "true" },
    encode: function(val) { return val ? 1 : 0; },
    equals: function(a, b) { return this.is(a) && a == b; },
    is: function(val) { return [true, false, 0, 1].indexOf(val) >= 0 },
    pattern: /false|true|0|1/
  })
}]);

并使用:

$stateProvider.state({
  url: '/my-route/{showSidebar:boolean}'
  template: '<my-page></my-page>'
});

Plunker相关的 SO 答案