Skip to content

Commit

Permalink
chore(docs): add relative naming docs for 'is', 'includes' and 'get'.
Browse files Browse the repository at this point in the history
  • Loading branch information
timkindberg committed Apr 25, 2014
1 parent da59af3 commit 90d3cfa
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -974,13 +974,18 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) {
*
* @example
* <pre>
* $state.$current.name = 'contacts.details.item';
*
* // absolute name
* $state.is('contact.details.item'); // returns true
* $state.is(contactDetailItemStateObject); // returns true
*
* // everything else would return false
* // relative name (. and ^), typically from a template
* // E.g. from the 'contacts.details' template
* <div ng-class="{highlighted: $state.is('.item')}">Item</div>
* </pre>
*
* @param {string|object} stateName The state name or state object you'd like to check.
* @param {string|object} stateName The state name (absolute or relative) or state object you'd like to check.
* @param {object=} params A param object, e.g. `{sectionId: section.id}`, that you'd like
* to test against the current active state.
* @returns {boolean} Returns true if it is the state.
Expand Down Expand Up @@ -1013,11 +1018,17 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) {
* <pre>
* $state.$current.name = 'contacts.details.item';
*
* // Using partial names
* $state.includes("contacts"); // returns true
* $state.includes("contacts.details"); // returns true
* $state.includes("contacts.details.item"); // returns true
* $state.includes("contacts.list"); // returns false
* $state.includes("about"); // returns false
*
* // Using relative names (. and ^), typically from a template
* // E.g. from the 'contacts.details' template
* <div ng-class="{highlighted: $state.includes('.item')}">Item</div>
*
* </pre>
*
* @description
Expand All @@ -1036,7 +1047,8 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) {
* $state.includes("item.**"); // returns false
* </pre>
*
* @param {string} stateOrName A partial name to be searched for within the current state name.
* @param {string} stateOrName A partial name, relative name, or glob pattern
* to be searched for within the current state name.
* @param {object} params A param object, e.g. `{sectionId: section.id}`,
* that you'd like to test against the current active state.
* @returns {boolean} Returns true if it does include the state
Expand Down Expand Up @@ -1118,7 +1130,7 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) {
* @description
* Returns the state configuration object for any specific state or all states.
*
* @param {string|object=} stateOrName If provided, will only get the config for
* @param {string|object=} stateOrName (absolute or relative) If provided, will only get the config for
* the requested state. If not provided, returns an array of ALL state configs.
* @returns {object|array} State configuration object or array of all objects.
*/
Expand Down

0 comments on commit 90d3cfa

Please sign in to comment.