Commit 284ed4f0 authored by colemanw's avatar colemanw

CRM-21497 - crmRouteBinder: add deep comparison option

parent 801ed48f
......@@ -51,6 +51,9 @@
options.format = options.format || 'json';
var fmt = formats[options.format];
if (options.deep) {
fmt.watcher = '$watch';
}
if (options.default === undefined) {
options.default = fmt.default;
}
......@@ -85,7 +88,7 @@
activeTimer = null;
ignorable = {};
}, 50);
});
}, options.deep);
};
return $delegate;
......
......@@ -30,16 +30,18 @@ Things to try out:
## Functions
* `$scope.$bindToRoute(options)`
* The `options` object should contain keys:
* `expr` (string): The name of a scoped variable to sync.
* `param` (string): The name of a query-parameter to sync. (If the `param` is included in the URL, it will initialize the expr.)
* `format` (string): The type of data to put in `param`. May be one of:
* `json` (default): The `param` is JSON, and the `expr` is a decoded object.
* `raw`: The `param` is string, and the `expr` is a string.
* `int`: the `param` is an integer-like string, and the expr is an integer.
* `bool`: The `param` is '0'/'1', and the `expr` is false/true.
* `default` (object): The default data. (If the `param` is not included in the URL, it will initialize the expr.)
**`$scope.$bindToRoute(options)`**
*The `options` object should contain keys:*
* `expr` (string): The name of a scoped variable to sync.
* `param` (string): The name of a query-parameter to sync. (If the `param` is included in the URL, it will initialize the expr.)
* `format` (string): The type of data to put in `param`. May be one of:
* `json` (default): The `param` is JSON, and the `expr` is a decoded object.
* `raw`: The `param` is string, and the `expr` is a string.
* `int`: the `param` is an integer-like string, and the expr is an integer.
* `bool`: The `param` is '0'/'1', and the `expr` is false/true.
* `default` (object): The default data. (If the `param` is not included in the URL, it will initialize the expr.)
* `deep` (boolean): By default the json format will be watched using a shallow comparison. For nested objects and arrays enable this option.
## Suggested Usage
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment