diff --git a/lib/index.ts b/lib/index.ts index 3518d97..d4c57dc 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -13,6 +13,7 @@ import { MATCH_ROUTE_PROVIDERS } from './match-route'; import { COMPONENT_RENDERER_PROVIDERS } from './component-renderer'; import { QUERY_PARAMS_PROVIDERS } from './query-params'; import { LINK_TO_PROVIDERS } from './link-to'; +import { LINK_ACTIVE_PROVIDERS } from './link-active'; export function provideRouter(routes: Routes) { return [ @@ -27,7 +28,8 @@ export function provideRouter(routes: Routes) { MATCH_ROUTE_PROVIDERS, COMPONENT_RENDERER_PROVIDERS, QUERY_PARAMS_PROVIDERS, - LINK_TO_PROVIDERS + LINK_TO_PROVIDERS, + LINK_ACTIVE_PROVIDERS ]; } @@ -42,3 +44,4 @@ export { Routes, Route, IndexRoute } from './route'; export { useTraversalMiddleware, TraversalCandidate } from './match-route'; export { QueryParams } from './query-params'; export { LinkTo } from './link-to'; +export { LinkActive } from './link-active'; diff --git a/lib/link-active.ts b/lib/link-active.ts index 0935f06..610888b 100644 --- a/lib/link-active.ts +++ b/lib/link-active.ts @@ -1,4 +1,16 @@ -import {Directive, Input, Query, QueryList, Renderer, ElementRef, AfterViewInit, OnDestroy} from 'angular2/core'; +import { + AfterViewInit, + Directive, + ElementRef, + Input, + OnDestroy, + Query, + QueryList, + PLATFORM_DIRECTIVES, + provide, + Provider, + Renderer +} from 'angular2/core'; import { LinkTo } from './link-to'; import { Location } from './location'; @@ -60,3 +72,10 @@ export interface ActiveOptions { } } } + + export const LINK_ACTIVE_PROVIDERS = [ + provide(PLATFORM_DIRECTIVES, { + multi: true, + useValue: [ LinkActive ] + }) + ];