mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-10 09:09:46 +08:00
@@ -399,15 +399,37 @@ LocationHashbangInHtml5Url.prototype =
|
||||
*
|
||||
* Change search part when called with parameter and return `$location`.
|
||||
*
|
||||
*
|
||||
* ```js
|
||||
* // given url http://example.com/#/some/path?foo=bar&baz=xoxo
|
||||
* var searchObject = $location.search();
|
||||
* // => {foo: 'bar', baz: 'xoxo'}
|
||||
*
|
||||
*
|
||||
* // set foo to 'yipee'
|
||||
* $location.search('foo', 'yipee');
|
||||
* // => $location
|
||||
* ```
|
||||
*
|
||||
* @param {string|Object.<string>|Object.<Array.<string>>} search New search params - string or
|
||||
* hash object. Hash object may contain an array of values, which will be decoded as duplicates in
|
||||
* the url.
|
||||
* hash object.
|
||||
*
|
||||
* @param {(string|Array<string>)=} paramValue If `search` is a string, then `paramValue` will override only a
|
||||
* single search parameter. If `paramValue` is an array, it will set the parameter as a
|
||||
* comma-separated value. If `paramValue` is `null`, the parameter will be deleted.
|
||||
* When called with a single argument the method acts as a setter, setting the `search` component
|
||||
* of `$location` to the specified value.
|
||||
*
|
||||
* @return {string} search
|
||||
* If the argument is a hash object containing an array of values, these values will be encoded
|
||||
* as duplicate search parameters in the url.
|
||||
*
|
||||
* @param {(string|Array<string>)=} paramValue If `search` is a string, then `paramValue` will
|
||||
* override only a single search property.
|
||||
*
|
||||
* If `paramValue` is an array, it will override the property of the `search` component of
|
||||
* `$location` specified via the first argument.
|
||||
*
|
||||
* If `paramValue` is `null`, the property specified via the first argument will be deleted.
|
||||
*
|
||||
* @return {Object} If called with no arguments returns the parsed `search` object. If called with
|
||||
* one or more arguments returns `$location` object itself.
|
||||
*/
|
||||
search: function(search, paramValue) {
|
||||
switch (arguments.length) {
|
||||
|
||||
Reference in New Issue
Block a user