UNPKG

1.38 kBJavaScriptView Raw
1/** @publicapi @module ng1 */ /** */
2import { ng as angular } from './angular';
3/**
4 * `isState` Filter: truthy if the current state is the parameter
5 *
6 * Translates to [[StateService.is]] `$state.is("stateName")`.
7 *
8 * #### Example:
9 * ```html
10 * <div ng-if="'stateName' | isState">show if state is 'stateName'</div>
11 * ```
12 */
13$IsStateFilter.$inject = ['$state'];
14function $IsStateFilter($state) {
15 var isFilter = function (state, params, options) {
16 return $state.is(state, params, options);
17 };
18 isFilter.$stateful = true;
19 return isFilter;
20}
21/**
22 * `includedByState` Filter: truthy if the current state includes the parameter
23 *
24 * Translates to [[StateService.includes]]` $state.is("fullOrPartialStateName")`.
25 *
26 * #### Example:
27 * ```html
28 * <div ng-if="'fullOrPartialStateName' | includedByState">show if state includes 'fullOrPartialStateName'</div>
29 * ```
30 */
31$IncludedByStateFilter.$inject = ['$state'];
32function $IncludedByStateFilter($state) {
33 var includesFilter = function (state, params, options) {
34 return $state.includes(state, params, options);
35 };
36 includesFilter.$stateful = true;
37 return includesFilter;
38}
39angular.module('ui.router.state').filter('isState', $IsStateFilter).filter('includedByState', $IncludedByStateFilter);
40export { $IsStateFilter, $IncludedByStateFilter };
41//# sourceMappingURL=stateFilters.js.map
\No newline at end of file