-
Notifications
You must be signed in to change notification settings - Fork 27.1k
improve(docs): add $location.search() example #7030
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -408,6 +408,16 @@ LocationHashbangInHtml5Url.prototype = | |
| * comma-separated value. If `paramValue` is `null`, the parameter will be deleted. | ||
| * | ||
| * @return {string} search | ||
| * | ||
| * @example If you want to get a specific value of the search, make sure you do not pass any arguments. | ||
| * | ||
| * <example> | ||
| // This will return the `$location` object: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is unclear and doesn't really tie well with your example. Returning the |
||
| $location.search('what-you-want') | ||
|
|
||
| // This will return give you the value you actually want: | ||
| $location.search()['what-you-want'] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When called as a getter (IE not setting any particular values), it will return the current set of key/value pairs representing the search query. This example does not make this clear, and should be improved.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you can turn this into a working example which should actually render markup to illustrate what it's doing, then by all means, use the |
||
| * </example> | ||
| */ | ||
| search: function(search, paramValue) { | ||
| switch (arguments.length) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use the
<example>doc tag for this, github flavoured markdown is just fine.