-
Notifications
You must be signed in to change notification settings - Fork 3k
/
Copy pathstateFilters.ts
37 lines (34 loc) · 973 Bytes
/
stateFilters.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/// <reference path='../../typings/angularjs/angular.d.ts' />
/**
* @ngdoc filter
* @name ui.router.state.filter:isState
*
* @requires ui.router.state.$state
*
* @description
* Translates to {@link ui.router.state.$state#methods_is $state.is("stateName")}.
*/
$IsStateFilter.$inject = ['$state'];
export function $IsStateFilter($state) {
return function(state) {
return $state.is(state);
};
}
/**
* @ngdoc filter
* @name ui.router.state.filter:includedByState
*
* @requires ui.router.state.$state
*
* @description
* Translates to {@link ui.router.state.$state#methods_includes $state.includes('fullOrPartialStateName')}.
*/
$IncludedByStateFilter.$inject = ['$state'];
export function $IncludedByStateFilter($state) {
return function(state, params, options) {
return $state.includes(state, params, options);
};
}
angular.module('ui.router.state')
.filter('isState', $IsStateFilter)
.filter('includedByState', $IncludedByStateFilter);