diff --git a/src/urlMatcherFactory.js b/src/urlMatcherFactory.js index 30ff0be0b..bc4e1eb4e 100644 --- a/src/urlMatcherFactory.js +++ b/src/urlMatcherFactory.js @@ -599,7 +599,7 @@ function $UrlMatcherFactory() { function valFromString(val) { return val != null ? val.toString().replace(/~2F/g, "/").replace(/~~/g, "~") : val; } var $types = {}, enqueue = true, typeQueue = [], injector, defaultTypes = { - string: { + "string": { encode: valToString, decode: valFromString, // TODO: in 1.0, make string .is() return false if value is undefined/null by default. @@ -607,19 +607,19 @@ function $UrlMatcherFactory() { is: function(val) { return val == null || !isDefined(val) || typeof val === "string"; }, pattern: /[^/]*/ }, - int: { + "int": { encode: valToString, decode: function(val) { return parseInt(val, 10); }, is: function(val) { return isDefined(val) && this.decode(val.toString()) === val; }, pattern: /\d+/ }, - bool: { + "bool": { encode: function(val) { return val ? 1 : 0; }, decode: function(val) { return parseInt(val, 10) !== 0; }, is: function(val) { return val === true || val === false; }, pattern: /0|1/ }, - date: { + "date": { encode: function (val) { if (!this.is(val)) return undefined; @@ -638,14 +638,14 @@ function $UrlMatcherFactory() { pattern: /[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2][0-9]|3[0-1])/, capture: /([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/ }, - json: { + "json": { encode: angular.toJson, decode: angular.fromJson, is: angular.isObject, equals: angular.equals, pattern: /[^/]*/ }, - any: { // does not encode/decode + "any": { // does not encode/decode encode: angular.identity, decode: angular.identity, equals: angular.equals,