@@ -399,15 +399,37 @@ LocationHashbangInHtml5Url.prototype =
399399 *
400400 * Change search part when called with parameter and return `$location`.
401401 *
402+ *
403+ * ```js
404+ * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
405+ * var searchObject = $location.search();
406+ * // => {foo: 'bar', baz: 'xoxo'}
407+ *
408+ *
409+ * // set foo to 'yipee'
410+ * $location.search('foo', 'yipee');
411+ * // => $location
412+ * ```
413+ *
402414 * @param {string|Object.<string>|Object.<Array.<string>> } search New search params - string or
403- * hash object. Hash object may contain an array of values, which will be decoded as duplicates in
404- * the url.
415+ * hash object.
416+ *
417+ * When called with a single argument the method acts as a setter, setting the `search` component
418+ * of `$location` to the specified value.
419+ *
420+ * If the argument is a hash object containing an array of values, these values will be encoded
421+ * as duplicate search parameters in the url.
422+ *
423+ * @param {(string|Array<string>)= } paramValue If `search` is a string, then `paramValue` will
424+ * override only a single search property.
425+ *
426+ * If `paramValue` is an array, it will override the property of the `search` component of
427+ * `$location` specified via the first argument.
405428 *
406- * @param {(string|Array<string>)= } paramValue If `search` is a string, then `paramValue` will override only a
407- * single search parameter. If `paramValue` is an array, it will set the parameter as a
408- * comma-separated value. If `paramValue` is `null`, the parameter will be deleted.
429+ * If `paramValue` is `null`, the property specified via the first argument will be deleted.
409430 *
410- * @return {string } search
431+ * @return {Object } If called with no arguments returns the parsed `search` object. If called with
432+ * one or more arguments returns `$location` object itself.
411433 */
412434 search : function ( search , paramValue ) {
413435 switch ( arguments . length ) {
0 commit comments