Skip to content

Commit

Permalink
fix(plugins): export modules for each plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
JonnyBGod committed Jan 6, 2017
1 parent fae88a5 commit 3069fe3
Show file tree
Hide file tree
Showing 17 changed files with 77 additions and 39 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Use ```ScrollSpyElementDirective``` to spy on any element. You must give an uniq

```js
import { NgModule, Component, Injectable, AfterViewInit } from '@angular/core';
import { ScrollSpyElementDirective, ScrollSpyService } from 'ng2-scrollspy';
import { ScrollSpyModule, ScrollSpyService } from 'ng2-scrollspy';

@Injectable()
@Component({
Expand All @@ -117,10 +117,11 @@ export class YourComponent implements AfterViewInit {
}

@NgModule({
imports: [ ],
imports: [
ScrollSpyModule
],
declarations: [
AppComponent,
ScrollSpyElementDirective
AppComponent
],
providers: [ ]
})
Expand Down
2 changes: 1 addition & 1 deletion dist/index.metadata.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"__symbolic":"module","version":1,"metadata":{"NG2SCROLLSPY_FORROOT_GUARD":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"OpaqueToken"},"arguments":["NG2SCROLLSPY_FORROOT_GUARD"]},"ScrollSpyModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"declarations":[{"__symbolic":"reference","module":"./core/window.directive","name":"ScrollSpyDirective"}],"exports":[{"__symbolic":"reference","module":"./core/window.directive","name":"ScrollSpyDirective"}]}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","name":"NG2SCROLLSPY_FORROOT_GUARD"}]}]],"parameters":[{"__symbolic":"reference","name":"any"}]}]},"statics":{"forRoot":{"__symbolic":"function","parameters":[],"value":{"ngModule":{"__symbolic":"reference","name":"ScrollSpyModule"},"providers":[{"provide":{"__symbolic":"reference","name":"NG2SCROLLSPY_FORROOT_GUARD"},"useFactory":{"__symbolic":"reference","name":"provideForRootGuard"},"deps":[[{"__symbolic":"reference","module":"./core/service","name":"ScrollSpyService"},{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"SkipSelf"}}]]},{"__symbolic":"reference","module":"./core/service","name":"ScrollSpyService"},{"__symbolic":"reference","module":"./plugin/index.service","name":"ScrollSpyIndexService"}]}}}}},"exports":[{"from":"./core/service"},{"from":"./core/window.directive"},{"from":"./core/element.directive"},{"from":"./plugin/index.service"}]}
{"__symbolic":"module","version":1,"metadata":{"NG2SCROLLSPY_FORROOT_GUARD":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"OpaqueToken"},"arguments":["NG2SCROLLSPY_FORROOT_GUARD"]},"ScrollSpyModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"declarations":[{"__symbolic":"reference","module":"./core/window.directive","name":"ScrollSpyDirective"},{"__symbolic":"reference","module":"./core/element.directive","name":"ScrollSpyElementDirective"}],"exports":[{"__symbolic":"reference","module":"./core/window.directive","name":"ScrollSpyDirective"},{"__symbolic":"reference","module":"./core/element.directive","name":"ScrollSpyElementDirective"}]}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","name":"NG2SCROLLSPY_FORROOT_GUARD"}]}]],"parameters":[{"__symbolic":"reference","name":"any"}]}]},"statics":{"forRoot":{"__symbolic":"function","parameters":[],"value":{"ngModule":{"__symbolic":"reference","name":"ScrollSpyModule"},"providers":[{"provide":{"__symbolic":"reference","name":"NG2SCROLLSPY_FORROOT_GUARD"},"useFactory":{"__symbolic":"reference","name":"provideForRootGuard"},"deps":[[{"__symbolic":"reference","module":"./core/service","name":"ScrollSpyService"},{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"SkipSelf"}}]]},{"__symbolic":"reference","module":"./core/service","name":"ScrollSpyService"},{"__symbolic":"reference","module":"./plugin/index.service","name":"ScrollSpyIndexService"}]}}}}},"exports":[{"from":"./core/service"},{"from":"./core/window.directive"},{"from":"./core/element.directive"},{"from":"./plugin/index.service"}]}
2 changes: 1 addition & 1 deletion dist/plugin/affix.metadata.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"__symbolic":"module","version":1,"metadata":{},"exports":[{"from":"./affix.directive"}]}
{"__symbolic":"module","version":1,"metadata":{"ScrollSpyAffixModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"declarations":[{"__symbolic":"reference","module":"./affix.directive","name":"ScrollSpyAffixDirective"}],"exports":[{"__symbolic":"reference","module":"./affix.directive","name":"ScrollSpyAffixDirective"}]}]}]}},"exports":[{"from":"./affix.directive"}]}
2 changes: 1 addition & 1 deletion dist/plugin/index.metadata.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"__symbolic":"module","version":1,"metadata":{},"exports":[{"from":"./index.service"},{"from":"./index.directive"},{"from":"./index.component"}]}
{"__symbolic":"module","version":1,"metadata":{"ScrollSpyIndexModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule"},{"__symbolic":"reference","module":"@angular/router","name":"RouterModule"}],"declarations":[{"__symbolic":"reference","module":"./index.directive","name":"ScrollSpyIndexDirective"},{"__symbolic":"reference","module":"./index.component","name":"ScrollSpyIndexRenderComponent"}],"exports":[{"__symbolic":"reference","module":"./index.directive","name":"ScrollSpyIndexDirective"},{"__symbolic":"reference","module":"./index.component","name":"ScrollSpyIndexRenderComponent"}]}]}]}},"exports":[{"from":"./index.service"},{"from":"./index.directive"},{"from":"./index.component"}]}
2 changes: 1 addition & 1 deletion dist/plugin/infinite.metadata.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"__symbolic":"module","version":1,"metadata":{},"exports":[{"from":"./infinite.directive"}]}
{"__symbolic":"module","version":1,"metadata":{"ScrollSpyInfinitexModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"declarations":[{"__symbolic":"reference","module":"./infinite.directive","name":"ScrollSpyInfiniteDirective"}],"exports":[{"__symbolic":"reference","module":"./infinite.directive","name":"ScrollSpyInfiniteDirective"}]}]}]}},"exports":[{"from":"./infinite.directive"}]}
2 changes: 1 addition & 1 deletion dist/plugin/parallax.metadata.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"__symbolic":"module","version":1,"metadata":{},"exports":[{"from":"./parallax.directive"}]}
{"__symbolic":"module","version":1,"metadata":{"ScrollSpyParallaxModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"declarations":[{"__symbolic":"reference","module":"./parallax.directive","name":"ScrollSpyParallaxDirective"}],"exports":[{"__symbolic":"reference","module":"./parallax.directive","name":"ScrollSpyParallaxDirective"}]}]}]}},"exports":[{"from":"./parallax.directive"}]}
4 changes: 1 addition & 3 deletions src/core/element.directive.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { TestBed, ComponentFixture, fakeAsync, inject } from '@angular/core/test
import { advance, createRoot } from '../test.mocks';

import { ScrollSpyModule, ScrollSpyService } from '../index';
import { ScrollSpyElementDirective } from './element.directive';

describe('core element.directive', () => {

Expand All @@ -17,8 +16,7 @@ describe('core element.directive', () => {
ScrollSpyModule.forRoot()
],
declarations: [
RootCmp,
ScrollSpyElementDirective
RootCmp
]
});

Expand Down
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {

import { ScrollSpyService } from './core/service';
import { ScrollSpyDirective } from './core/window.directive';
import { ScrollSpyElementDirective } from './core/element.directive';

import { ScrollSpyIndexService } from './plugin/index.service';

Expand All @@ -27,8 +28,8 @@ export function provideForRootGuard(scrollSpyService: ScrollSpyService): any {
}

@NgModule({
declarations: [ ScrollSpyDirective ],
exports: [ ScrollSpyDirective ]
declarations: [ ScrollSpyDirective, ScrollSpyElementDirective ],
exports: [ ScrollSpyDirective, ScrollSpyElementDirective ]
})
export class ScrollSpyModule {
constructor(@Optional() @Inject(NG2SCROLLSPY_FORROOT_GUARD) guard: any) {}
Expand Down
8 changes: 4 additions & 4 deletions src/plugin/affix.directive.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { TestBed, ComponentFixture, fakeAsync, inject } from '@angular/core/test
import { advance, createRoot } from '../test.mocks';

import { ScrollSpyModule } from '../index';
import { ScrollSpyAffixDirective } from './affix.directive';
import { ScrollSpyAffixModule } from './affix';

describe('plugin affix.directive', () => {

Expand All @@ -13,11 +13,11 @@ describe('plugin affix.directive', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
ScrollSpyModule.forRoot()
ScrollSpyModule.forRoot(),
ScrollSpyAffixModule
],
declarations: [
RootCmp,
ScrollSpyAffixDirective
RootCmp
]
});
});
Expand Down
10 changes: 10 additions & 0 deletions src/plugin/affix.ts
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
import { NgModule } from '@angular/core';

export * from './affix.directive';

import { ScrollSpyAffixDirective } from './affix.directive';

@NgModule({
declarations: [ ScrollSpyAffixDirective ],
exports: [ ScrollSpyAffixDirective ]
})
export class ScrollSpyAffixModule {}
8 changes: 3 additions & 5 deletions src/plugin/index.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { advance, createRoot } from '../test.mocks';

import { ScrollSpyModule } from '../index';
import { ScrollSpyIndexDirective } from './index.directive';
import { ScrollSpyIndexRenderComponent } from './index.component';
import { ScrollSpyIndexModule } from './index';

describe('plugin index.render.directive', () => {

Expand All @@ -17,11 +16,10 @@ describe('plugin index.render.directive', () => {
TestBed.configureTestingModule({
imports: [
RouterTestingModule,
ScrollSpyModule.forRoot()
ScrollSpyModule.forRoot(),
ScrollSpyIndexModule
],
declarations: [
ScrollSpyIndexRenderComponent,
ScrollSpyIndexDirective,
RootCmp
]
});
Expand Down
8 changes: 4 additions & 4 deletions src/plugin/index.directive.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { TestBed, ComponentFixture, fakeAsync, inject } from '@angular/core/test
import { advance, createRoot } from '../test.mocks';

import { ScrollSpyModule } from '../index';
import { ScrollSpyIndexDirective } from './index.directive';
import { ScrollSpyIndexModule } from './index';
import { ScrollSpyIndexService } from './index.service';

describe('plugin index.directive', () => {
Expand All @@ -14,11 +14,11 @@ describe('plugin index.directive', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
ScrollSpyModule.forRoot()
ScrollSpyModule.forRoot(),
ScrollSpyIndexModule
],
declarations: [
RootCmp,
ScrollSpyIndexDirective
RootCmp
]
});
});
Expand Down
14 changes: 14 additions & 0 deletions src/plugin/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule } from '@angular/router';

export * from './index.service';
export * from './index.directive';
export * from './index.component';

import { ScrollSpyIndexDirective } from './index.directive';
import { ScrollSpyIndexRenderComponent } from './index.component';

@NgModule({
imports: [ CommonModule, RouterModule ],
declarations: [ ScrollSpyIndexDirective, ScrollSpyIndexRenderComponent ],
exports: [ ScrollSpyIndexDirective, ScrollSpyIndexRenderComponent ]
})
export class ScrollSpyIndexModule {}
10 changes: 4 additions & 6 deletions src/plugin/infinite.directive.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { TestBed, ComponentFixture, fakeAsync, inject, tick } from '@angular/cor
import { advance, createRoot } from '../test.mocks';

import { ScrollSpyModule } from '../index';
import { ScrollSpyElementDirective } from '../index';
import { ScrollSpyInfiniteDirective } from './infinite.directive';
import { ScrollSpyInfiniteModule } from './infinite';

describe('plugin infinite.directive', () => {

Expand All @@ -18,13 +17,12 @@ describe('plugin infinite.directive', () => {

TestBed.configureTestingModule({
imports: [
ScrollSpyModule.forRoot()
ScrollSpyModule.forRoot(),
ScrollSpyInfiniteModule
],
declarations: [
RootCmp,
RootElementCmp,
ScrollSpyElementDirective,
ScrollSpyInfiniteDirective
RootElementCmp
]
});
});
Expand Down
10 changes: 10 additions & 0 deletions src/plugin/infinite.ts
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
import { NgModule } from '@angular/core';

export * from './infinite.directive';

import { ScrollSpyInfiniteDirective } from './infinite.directive';

@NgModule({
declarations: [ ScrollSpyInfiniteDirective ],
exports: [ ScrollSpyInfiniteDirective ]
})
export class ScrollSpyInfiniteModule {}
10 changes: 4 additions & 6 deletions src/plugin/parallax.directive.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { TestBed, ComponentFixture, fakeAsync, inject } from '@angular/core/test
import { advance, createRoot } from '../test.mocks';

import { ScrollSpyModule } from '../index';
import { ScrollSpyElementDirective } from '../index';
import { ScrollSpyParallaxDirective } from './parallax.directive';
import { ScrollSpyParallaxModule } from './parallax';

describe('plugin parallax.directive', () => {

Expand All @@ -15,13 +14,12 @@ describe('plugin parallax.directive', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
ScrollSpyModule.forRoot()
ScrollSpyModule.forRoot(),
ScrollSpyParallaxModule
],
declarations: [
RootCmp,
RootElementCmp,
ScrollSpyElementDirective,
ScrollSpyParallaxDirective
RootElementCmp
]
});
});
Expand Down
10 changes: 10 additions & 0 deletions src/plugin/parallax.ts
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
import { NgModule } from '@angular/core';

export * from './parallax.directive';

import { ScrollSpyParallaxDirective } from './parallax.directive';

@NgModule({
declarations: [ ScrollSpyParallaxDirective ],
exports: [ ScrollSpyParallaxDirective ]
})
export class ScrollSpyParallaxModule {}

0 comments on commit 3069fe3

Please sign in to comment.