diff --git a/src/state.js b/src/state.js index 5bac8bfb8..0ab449ec7 100644 --- a/src/state.js +++ b/src/state.js @@ -974,13 +974,18 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) { * * @example *
+ * $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 + ** - * @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. @@ -1013,11 +1018,17 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) { *Item*
* $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 + ** * @description @@ -1036,7 +1047,8 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) { * $state.includes("item.**"); // returns false * * - * @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 @@ -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. */Item+ * *