Skip to content

Commit

Permalink
fix(LinkActive): Added linkActive directive to platform directives
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonroberts authored and MikeRyanDev committed Apr 4, 2016
1 parent 093d223 commit 63f3831
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
Expand All @@ -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
];
}

Expand All @@ -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';
21 changes: 20 additions & 1 deletion lib/link-active.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -60,3 +72,10 @@ export interface ActiveOptions {
}
}
}

export const LINK_ACTIVE_PROVIDERS = [
provide(PLATFORM_DIRECTIVES, {
multi: true,
useValue: [ LinkActive ]
})
];

0 comments on commit 63f3831

Please sign in to comment.