Skip to content

Commit

Permalink
fix(all): add forRoot() to all modules (#1166)
Browse files Browse the repository at this point in the history
  • Loading branch information
kara authored Sep 2, 2016
1 parent 3ef7ece commit 21dc44a
Show file tree
Hide file tree
Showing 29 changed files with 164 additions and 45 deletions.
32 changes: 16 additions & 16 deletions src/lib/all/all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,29 +55,29 @@ const MATERIAL_MODULES = [

@NgModule({
imports: [
MdButtonModule,
MdCardModule,
MdCheckboxModule,
MdGridListModule,
MdInputModule,
MdListModule,
MdProgressBarModule,
MdProgressCircleModule,
MdRippleModule,
MdSidenavModule,
MdSliderModule,
MdSlideToggleModule,
MdTabsModule,
MdToolbarModule,
PortalModule,
RtlModule,
MdButtonModule.forRoot(),
MdCardModule.forRoot(),
MdCheckboxModule.forRoot(),
MdGridListModule.forRoot(),
MdInputModule.forRoot(),
MdListModule.forRoot(),
MdProgressBarModule.forRoot(),
MdProgressCircleModule.forRoot(),
MdRippleModule.forRoot(),
MdSidenavModule.forRoot(),
MdTabsModule.forRoot(),
MdToolbarModule.forRoot(),
PortalModule.forRoot(),
RtlModule.forRoot(),

// These modules include providers.
MdButtonToggleModule.forRoot(),
MdDialogModule.forRoot(),
MdIconModule.forRoot(),
MdMenuModule.forRoot(),
MdRadioModule.forRoot(),
MdSliderModule.forRoot(),
MdSlideToggleModule.forRoot(),
MdTooltipModule.forRoot(),
OverlayModule.forRoot(),
],
Expand Down
2 changes: 1 addition & 1 deletion src/lib/button/button.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('MdButton', () => {

beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [MdButtonModule],
imports: [MdButtonModule.forRoot()],
declarations: [TestApp],
});

Expand Down
10 changes: 9 additions & 1 deletion src/lib/button/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
ElementRef,
Renderer,
NgModule,
ModuleWithProviders,
} from '@angular/core';
import {CommonModule} from '@angular/common';
import {BooleanFieldValue} from '@angular2-material/core';
Expand Down Expand Up @@ -161,4 +162,11 @@ export class MdAnchor extends MdButton {
exports: [MdButton, MdAnchor],
declarations: [MdButton, MdAnchor],
})
export class MdButtonModule { }
export class MdButtonModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: MdButtonModule,
providers: []
};
}
}
10 changes: 9 additions & 1 deletion src/lib/card/card.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
NgModule,
ModuleWithProviders,
Component,
ViewEncapsulation,
ChangeDetectionStrategy,
Expand Down Expand Up @@ -124,4 +125,11 @@ export class MdCardTitleGroup {}
MdCardActions
],
})
export class MdCardModule { }
export class MdCardModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: MdCardModule,
providers: []
};
}
}
2 changes: 1 addition & 1 deletion src/lib/checkbox/checkbox.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('MdCheckbox', () => {

beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [MdCheckboxModule, FormsModule],
imports: [MdCheckboxModule.forRoot(), FormsModule],
declarations: [
SingleCheckbox,
CheckboxWithFormDirectives,
Expand Down
10 changes: 9 additions & 1 deletion src/lib/checkbox/checkbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
ViewEncapsulation,
forwardRef,
NgModule,
ModuleWithProviders,
} from '@angular/core';
import {NG_VALUE_ACCESSOR, ControlValueAccessor} from '@angular/forms';

Expand Down Expand Up @@ -309,4 +310,11 @@ export class MdCheckbox implements ControlValueAccessor {
exports: [MdCheckbox],
declarations: [MdCheckbox],
})
export class MdCheckboxModule { }
export class MdCheckboxModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: MdCheckboxModule,
providers: []
};
}
}
10 changes: 9 additions & 1 deletion src/lib/core/portal/portal-directives.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
NgModule,
ModuleWithProviders,
ComponentRef,
Directive,
TemplateRef,
Expand Down Expand Up @@ -107,4 +108,11 @@ export class PortalHostDirective extends BasePortalHost {
exports: [TemplatePortalDirective, PortalHostDirective],
declarations: [TemplatePortalDirective, PortalHostDirective],
})
export class PortalModule { }
export class PortalModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: PortalModule,
providers: []
};
}
}
2 changes: 1 addition & 1 deletion src/lib/core/portal/portal.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('Portals', () => {

beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [PortalModule, PortalTestModule],
imports: [PortalModule.forRoot(), PortalTestModule],
});

TestBed.compileComponents();
Expand Down
2 changes: 1 addition & 1 deletion src/lib/core/ripple/ripple.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe('MdRipple', () => {

beforeEach(() => {
TestBed.configureTestingModule({
imports: [MdRippleModule],
imports: [MdRippleModule.forRoot()],
declarations: [BasicRippleContainer, RippleContainerWithInputBindings],
});
});
Expand Down
10 changes: 9 additions & 1 deletion src/lib/core/ripple/ripple.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
NgModule,
ModuleWithProviders,
Directive,
ElementRef,
HostBinding,
Expand Down Expand Up @@ -173,4 +174,11 @@ export class MdRipple implements OnInit, OnDestroy, OnChanges {
exports: [MdRipple],
declarations: [MdRipple],
})
export class MdRippleModule { }
export class MdRippleModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: MdRippleModule,
providers: []
};
}
}
19 changes: 17 additions & 2 deletions src/lib/core/rtl/dir.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import {NgModule, Directive, HostBinding, Output, Input, EventEmitter} from '@angular/core';
import {
NgModule,
ModuleWithProviders,
Directive,
HostBinding,
Output,
Input,
EventEmitter
} from '@angular/core';

export type LayoutDirection = 'ltr' | 'rtl';

Expand Down Expand Up @@ -39,4 +47,11 @@ export class Dir {
exports: [Dir],
declarations: [Dir]
})
export class RtlModule { }
export class RtlModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: RtlModule,
providers: []
};
}
}
2 changes: 1 addition & 1 deletion src/lib/grid-list/grid-list.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {MdGridTile, MdGridTileText} from './grid-tile';
describe('MdGridList', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [MdGridListModule],
imports: [MdGridListModule.forRoot()],
declarations: [
GridListWithoutCols,
GridListWithInvalidRowHeightRatio,
Expand Down
10 changes: 9 additions & 1 deletion src/lib/grid-list/grid-list.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
NgModule,
ModuleWithProviders,
Component,
ViewEncapsulation,
AfterContentChecked,
Expand Down Expand Up @@ -156,4 +157,11 @@ export class MdGridList implements OnInit, AfterContentChecked {
exports: [MdGridList, MdGridTile, MdGridTileText, MdLineModule],
declarations: [MdGridList, MdGridTile, MdGridTileText],
})
export class MdGridListModule { }
export class MdGridListModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: MdGridListModule,
providers: []
};
}
}
2 changes: 1 addition & 1 deletion src/lib/input/input.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {MdInput, MdInputModule} from './input';
describe('MdInput', function () {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [MdInputModule, FormsModule],
imports: [MdInputModule.forRoot(), FormsModule],
declarations: [
MdInputNumberTypeConservedTestComponent,
MdInputPlaceholderRequiredTestComponent,
Expand Down
10 changes: 9 additions & 1 deletion src/lib/input/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
EventEmitter,
Output,
NgModule,
ModuleWithProviders,
} from '@angular/core';
import {
NG_VALUE_ACCESSOR,
Expand Down Expand Up @@ -312,4 +313,11 @@ export class MdInput implements ControlValueAccessor, AfterContentInit, OnChange
imports: [CommonModule, FormsModule],
exports: [MdPlaceholder, MdInput, MdHint],
})
export class MdInputModule { }
export class MdInputModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: MdInputModule,
providers: []
};
}
}
2 changes: 1 addition & 1 deletion src/lib/list/list.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('MdList', () => {

beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [MdListModule],
imports: [MdListModule.forRoot()],
declarations: [
ListWithOneAnchorItem,
ListWithOneItem,
Expand Down
10 changes: 9 additions & 1 deletion src/lib/list/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
Renderer,
AfterContentInit,
NgModule,
ModuleWithProviders,
} from '@angular/core';
import {MdLine, MdLineSetter, MdLineModule} from '@angular2-material/core';

Expand Down Expand Up @@ -76,4 +77,11 @@ export class MdListItem implements AfterContentInit {
exports: [MdList, MdListItem, MdListDivider, MdListAvatar, MdLineModule],
declarations: [MdList, MdListItem, MdListDivider, MdListAvatar],
})
export class MdListModule { }
export class MdListModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: MdListModule,
providers: []
};
}
}
2 changes: 1 addition & 1 deletion src/lib/progress-bar/progress-bar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('MdProgressBar', () => {

beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [MdProgressBarModule],
imports: [MdProgressBarModule.forRoot()],
declarations: [
BasicProgressBar,
BufferProgressBar,
Expand Down
10 changes: 9 additions & 1 deletion src/lib/progress-bar/progress-bar.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
NgModule,
ModuleWithProviders,
Component,
ChangeDetectionStrategy,
HostBinding,
Expand Down Expand Up @@ -92,4 +93,11 @@ function clamp(v: number, min = 0, max = 100) {
exports: [MdProgressBar],
declarations: [MdProgressBar],
})
export class MdProgressBarModule { }
export class MdProgressBarModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: MdProgressBarModule,
providers: []
};
}
}
2 changes: 1 addition & 1 deletion src/lib/progress-circle/progress-circle.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('MdProgressCircular', () => {

beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [MdProgressCircleModule],
imports: [MdProgressCircleModule.forRoot()],
declarations: [
BasicProgressSpinner,
IndeterminateProgressSpinner,
Expand Down
10 changes: 9 additions & 1 deletion src/lib/progress-circle/progress-circle.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
NgModule,
ModuleWithProviders,
Component,
HostBinding,
ChangeDetectorRef,
Expand Down Expand Up @@ -318,4 +319,11 @@ function getSvgArc(currentValue: number, rotation: number) {
exports: [MdProgressCircle, MdSpinner],
declarations: [MdProgressCircle, MdSpinner],
})
export class MdProgressCircleModule { }
export class MdProgressCircleModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: MdProgressCircleModule,
providers: []
};
}
}
2 changes: 1 addition & 1 deletion src/lib/sidenav/sidenav.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('MdSidenav', () => {

beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [MdSidenavModule],
imports: [MdSidenavModule.forRoot()],
declarations: [
BasicTestApp,
SidenavLayoutTwoSidenavTestApp,
Expand Down
10 changes: 9 additions & 1 deletion src/lib/sidenav/sidenav.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
NgModule,
ModuleWithProviders,
AfterContentInit,
Component,
ContentChildren,
Expand Down Expand Up @@ -389,4 +390,11 @@ export class MdSidenavLayout implements AfterContentInit {
exports: [MdSidenavLayout, MdSidenav],
declarations: [MdSidenavLayout, MdSidenav],
})
export class MdSidenavModule { }
export class MdSidenavModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: MdSidenavModule,
providers: []
};
}
}
2 changes: 1 addition & 1 deletion src/lib/slide-toggle/slide-toggle.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('MdSlideToggle', () => {

beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [MdSlideToggleModule, FormsModule],
imports: [MdSlideToggleModule.forRoot(), FormsModule],
declarations: [SlideToggleTestApp],
});

Expand Down
Loading

0 comments on commit 21dc44a

Please sign in to comment.