@@ -974,13 +974,18 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) {
974
974
*
975
975
* @example
976
976
* <pre>
977
+ * $state.$current.name = 'contacts.details.item';
978
+ *
979
+ * // absolute name
977
980
* $state.is('contact.details.item'); // returns true
978
981
* $state.is(contactDetailItemStateObject); // returns true
979
982
*
980
- * // everything else would return false
983
+ * // relative name (. and ^), typically from a template
984
+ * // E.g. from the 'contacts.details' template
985
+ * <div ng-class="{highlighted: $state.is('.item')}">Item</div>
981
986
* </pre>
982
987
*
983
- * @param {string|object } stateName The state name or state object you'd like to check.
988
+ * @param {string|object } stateName The state name (absolute or relative) or state object you'd like to check.
984
989
* @param {object= } params A param object, e.g. `{sectionId: section.id}`, that you'd like
985
990
* to test against the current active state.
986
991
* @returns {boolean } Returns true if it is the state.
@@ -1013,11 +1018,17 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) {
1013
1018
* <pre>
1014
1019
* $state.$current.name = 'contacts.details.item';
1015
1020
*
1021
+ * // Using partial names
1016
1022
* $state.includes("contacts"); // returns true
1017
1023
* $state.includes("contacts.details"); // returns true
1018
1024
* $state.includes("contacts.details.item"); // returns true
1019
1025
* $state.includes("contacts.list"); // returns false
1020
1026
* $state.includes("about"); // returns false
1027
+ *
1028
+ * // Using relative names (. and ^), typically from a template
1029
+ * // E.g. from the 'contacts.details' template
1030
+ * <div ng-class="{highlighted: $state.includes('.item')}">Item</div>
1031
+ *
1021
1032
* </pre>
1022
1033
*
1023
1034
* @description
@@ -1036,7 +1047,8 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) {
1036
1047
* $state.includes("item.**"); // returns false
1037
1048
* </pre>
1038
1049
*
1039
- * @param {string } stateOrName A partial name to be searched for within the current state name.
1050
+ * @param {string } stateOrName A partial name, relative name, or glob pattern
1051
+ * to be searched for within the current state name.
1040
1052
* @param {object } params A param object, e.g. `{sectionId: section.id}`,
1041
1053
* that you'd like to test against the current active state.
1042
1054
* @returns {boolean } Returns true if it does include the state
@@ -1118,7 +1130,7 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) {
1118
1130
* @description
1119
1131
* Returns the state configuration object for any specific state or all states.
1120
1132
*
1121
- * @param {string|object= } stateOrName If provided, will only get the config for
1133
+ * @param {string|object= } stateOrName (absolute or relative) If provided, will only get the config for
1122
1134
* the requested state. If not provided, returns an array of ALL state configs.
1123
1135
* @returns {object|array } State configuration object or array of all objects.
1124
1136
*/
0 commit comments