/** @ng2api @module directives */ /** */ import { ElementRef, Renderer } from "@angular/core"; import { UISrefStatus } from "./uiSrefStatus"; /** * A directive that adds a CSS class when its associated `uiSref` link is active. * * ### Purpose * * This directive should be paired with one (or more) [[UISref]] directives. * It will apply a CSS class to its element when the state the `uiSref` targets is activated. * * This can be used to create navigation UI where the active link is highlighted. * * ### Selectors * * - `[uiSrefActive]`: When this selector is used, the class is added when the target state or any * child of the target state is active * - `[uiSrefActiveEq]`: When this selector is used, the class is added when the target state is * exactly active (the class is not added if a child of the target state is active). * * ### Inputs * * - `uiSrefActive`/`uiSrefActiveEq`: one or more CSS classes to add to the element, when the `uiSref` is active * * #### Example: * The anchor tag has the `active` class added when the `foo` state is active. * ```html * Foo * ``` * * ### Matching parameters * * If the `uiSref` includes parameters, the current state must be active, *and* the parameter values must match. * * #### Example: * The first anchor tag has the `active` class added when the `foo.bar` state is active and the `id` parameter * equals 25. * The second anchor tag has the `active` class added when the `foo.bar` state is active and the `id` parameter * equals 32. * ```html * Bar #25 * Bar #32 * ``` * * #### Example: * A list of anchor tags are created for a list of `bar` objects. * An anchor tag will have the `active` class when `foo.bar` state is active and the `id` parameter matches * that object's `id`. * ```html *