Define:
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/
})
}]);
And use:
$stateProvider.state({
url: '/my-route/{showSidebar:boolean}'
template: '<my-page></my-page>'
});
Plunker and related SO answer.