angular-ui-router
Version:
State-based routing for AngularJS 1.x
42 lines • 1.35 kB
JavaScript
/** @module ng1 */ /** for typedoc */
import { ng as angular } from "./angular";
/**
* `isState` Filter: truthy if the current state is the parameter
*
* Translates to [[StateService.is]] `$state.is("stateName")`.
*
* #### Example:
* ```html
* <div ng-if="'stateName' | isState">show if state is 'stateName'</div>
* ```
*/
$IsStateFilter.$inject = ['$state'];
export function $IsStateFilter($state) {
var isFilter = function (state, params, options) {
return $state.is(state, params, options);
};
isFilter.$stateful = true;
return isFilter;
}
/**
* `includedByState` Filter: truthy if the current state includes the parameter
*
* Translates to [[StateService.includes]]` $state.is("fullOrPartialStateName")`.
*
* #### Example:
* ```html
* <div ng-if="'fullOrPartialStateName' | includedByState">show if state includes 'fullOrPartialStateName'</div>
* ```
*/
$IncludedByStateFilter.$inject = ['$state'];
export function $IncludedByStateFilter($state) {
var includesFilter = function (state, params, options) {
return $state.includes(state, params, options);
};
includesFilter.$stateful = true;
return includesFilter;
}
angular.module('ui.router.state')
.filter('isState', $IsStateFilter)
.filter('includedByState', $IncludedByStateFilter);
//# sourceMappingURL=stateFilters.js.map