Skip to content

Commit c94f471

Browse files
devversionmmalerba
authored andcommitted
fix: remove deprecated forRoot functions (#3539)
* In beta.2 the `forRoot` calls have been deprecated, and it was stated that those will be removed in the next release (https://goo.gl/2yFPFc)
1 parent 29e503a commit c94f471

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+97
-412
lines changed

src/demo-app/demo-app-module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ import {StyleDemo} from './style/style-demo';
5353
HttpModule,
5454
ReactiveFormsModule,
5555
RouterModule.forRoot(DEMO_APP_ROUTES),
56-
MaterialModule.forRoot(),
56+
MaterialModule,
5757
MdSelectionModule,
5858
],
5959
declarations: [

src/e2e-app/e2e-app-module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {InputE2E} from './input/input-e2e';
2424
imports: [
2525
BrowserModule,
2626
RouterModule.forRoot(E2E_APP_ROUTES),
27-
MaterialModule.forRoot(),
27+
MaterialModule,
2828
NoopAnimationsModule,
2929
],
3030
declarations: [

src/lib/autocomplete/autocomplete.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ describe('MdAutocomplete', () => {
3939
dir = 'ltr';
4040
TestBed.configureTestingModule({
4141
imports: [
42-
MdAutocompleteModule.forRoot(),
43-
MdInputModule.forRoot(),
42+
MdAutocompleteModule,
43+
MdInputModule,
4444
FormsModule,
4545
ReactiveFormsModule,
4646
NoopAnimationsModule

src/lib/autocomplete/index.ts

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import {ModuleWithProviders, NgModule} from '@angular/core';
2-
3-
import {MdOptionModule, OverlayModule, OVERLAY_PROVIDERS, MdCommonModule} from '../core';
1+
import {NgModule} from '@angular/core';
2+
import {MdOptionModule, OverlayModule, MdCommonModule} from '../core';
43
import {CommonModule} from '@angular/common';
54
import {MdAutocomplete} from './autocomplete';
65
import {MdAutocompleteTrigger} from './autocomplete-trigger';
@@ -10,15 +9,7 @@ import {MdAutocompleteTrigger} from './autocomplete-trigger';
109
exports: [MdAutocomplete, MdOptionModule, MdAutocompleteTrigger, MdCommonModule],
1110
declarations: [MdAutocomplete, MdAutocompleteTrigger],
1211
})
13-
export class MdAutocompleteModule {
14-
/** @deprecated */
15-
static forRoot(): ModuleWithProviders {
16-
return {
17-
ngModule: MdAutocompleteModule,
18-
providers: [OVERLAY_PROVIDERS]
19-
};
20-
}
21-
}
12+
export class MdAutocompleteModule {}
2213

2314

2415
export * from './autocomplete';

src/lib/button-toggle/button-toggle.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe('MdButtonToggle', () => {
2121

2222
beforeEach(async(() => {
2323
TestBed.configureTestingModule({
24-
imports: [MdButtonToggleModule.forRoot(), FormsModule, ReactiveFormsModule],
24+
imports: [MdButtonToggleModule, FormsModule, ReactiveFormsModule],
2525
declarations: [
2626
ButtonTogglesInsideButtonToggleGroup,
2727
ButtonToggleGroupWithNgModel,

src/lib/button-toggle/index.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {NgModule, ModuleWithProviders} from '@angular/core';
1+
import {NgModule} from '@angular/core';
22
import {FormsModule} from '@angular/forms';
33
import {MdButtonToggleGroup, MdButtonToggleGroupMultiple, MdButtonToggle} from './button-toggle';
44
import {
@@ -19,15 +19,7 @@ import {
1919
declarations: [MdButtonToggleGroup, MdButtonToggleGroupMultiple, MdButtonToggle],
2020
providers: [UNIQUE_SELECTION_DISPATCHER_PROVIDER, FocusOriginMonitor]
2121
})
22-
export class MdButtonToggleModule {
23-
/** @deprecated */
24-
static forRoot(): ModuleWithProviders {
25-
return {
26-
ngModule: MdButtonToggleModule,
27-
providers: []
28-
};
29-
}
30-
}
22+
export class MdButtonToggleModule {}
3123

3224

3325
export * from './button-toggle';

src/lib/button/button.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ describe('MdButton', () => {
1010

1111
beforeEach(async(() => {
1212
TestBed.configureTestingModule({
13-
imports: [MdButtonModule.forRoot()],
13+
imports: [MdButtonModule],
1414
declarations: [TestApp],
1515
providers: [
1616
{provide: ViewportRuler, useClass: FakeViewportRuler},

src/lib/button/index.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {ModuleWithProviders, NgModule} from '@angular/core';
1+
import {NgModule} from '@angular/core';
22
import {CommonModule} from '@angular/common';
33
import {MdCommonModule, MdRippleModule, StyleModule} from '../core';
44
import {
@@ -42,12 +42,4 @@ export * from './button';
4242
MdMiniFabCssMatStyler,
4343
],
4444
})
45-
export class MdButtonModule {
46-
/** @deprecated */
47-
static forRoot(): ModuleWithProviders {
48-
return {
49-
ngModule: MdButtonModule,
50-
providers: []
51-
};
52-
}
53-
}
45+
export class MdButtonModule {}

src/lib/card/index.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {NgModule, ModuleWithProviders} from '@angular/core';
1+
import {NgModule} from '@angular/core';
22
import {MdCommonModule} from '../core';
33
import {
44
MdCard,
@@ -43,15 +43,7 @@ import {
4343
MdCardXlImage, MdCardAvatar,
4444
],
4545
})
46-
export class MdCardModule {
47-
/** @deprecated */
48-
static forRoot(): ModuleWithProviders {
49-
return {
50-
ngModule: MdCardModule,
51-
providers: []
52-
};
53-
}
54-
}
46+
export class MdCardModule {}
5547

5648

5749
export * from './card';

src/lib/checkbox/checkbox.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe('MdCheckbox', () => {
2121

2222
beforeEach(async(() => {
2323
TestBed.configureTestingModule({
24-
imports: [MdCheckboxModule.forRoot(), FormsModule, ReactiveFormsModule],
24+
imports: [MdCheckboxModule, FormsModule, ReactiveFormsModule],
2525
declarations: [
2626
SingleCheckbox,
2727
CheckboxWithFormDirectives,

src/lib/checkbox/index.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {NgModule, ModuleWithProviders} from '@angular/core';
1+
import {NgModule} from '@angular/core';
22
import {CommonModule} from '@angular/common';
33
import {MdRippleModule, MdCommonModule, FocusOriginMonitor} from '../core';
44
import {MdCheckbox} from './checkbox';
@@ -10,15 +10,7 @@ import {MdCheckbox} from './checkbox';
1010
declarations: [MdCheckbox],
1111
providers: [FocusOriginMonitor]
1212
})
13-
export class MdCheckboxModule {
14-
/** @deprecated */
15-
static forRoot(): ModuleWithProviders {
16-
return {
17-
ngModule: MdCheckboxModule,
18-
providers: []
19-
};
20-
}
21-
}
13+
export class MdCheckboxModule {}
2214

2315

2416
export * from './checkbox';

src/lib/chips/chip-list.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe('MdChipList', () => {
2525

2626
beforeEach(async(() => {
2727
TestBed.configureTestingModule({
28-
imports: [MdChipsModule.forRoot()],
28+
imports: [MdChipsModule],
2929
declarations: [
3030
StaticChipList
3131
]

src/lib/chips/chip.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe('Chips', () => {
1212

1313
beforeEach(async(() => {
1414
TestBed.configureTestingModule({
15-
imports: [MdChipsModule.forRoot()],
15+
imports: [MdChipsModule],
1616
declarations: [
1717
BasicChip, SingleChip
1818
]

src/lib/chips/index.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {NgModule, ModuleWithProviders} from '@angular/core';
1+
import {NgModule} from '@angular/core';
22
import {MdChipList} from './chip-list';
33
import {MdChip} from './chip';
44

@@ -8,15 +8,7 @@ import {MdChip} from './chip';
88
exports: [MdChipList, MdChip],
99
declarations: [MdChipList, MdChip]
1010
})
11-
export class MdChipsModule {
12-
/** @deprecated */
13-
static forRoot(): ModuleWithProviders {
14-
return {
15-
ngModule: MdChipsModule,
16-
providers: []
17-
};
18-
}
19-
}
11+
export class MdChipsModule {}
2012

2113

2214
export * from './chip-list';

src/lib/core/a11y/index.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {NgModule, ModuleWithProviders} from '@angular/core';
1+
import {NgModule} from '@angular/core';
22
import {FocusTrapDirective, FocusTrapDeprecatedDirective, FocusTrapFactory} from './focus-trap';
33
import {LIVE_ANNOUNCER_PROVIDER} from './live-announcer';
44
import {InteractivityChecker} from './interactivity-checker';
@@ -11,12 +11,4 @@ import {PlatformModule} from '../platform/index';
1111
exports: [FocusTrapDirective, FocusTrapDeprecatedDirective],
1212
providers: [InteractivityChecker, FocusTrapFactory, LIVE_ANNOUNCER_PROVIDER]
1313
})
14-
export class A11yModule {
15-
/** @deprecated */
16-
static forRoot(): ModuleWithProviders {
17-
return {
18-
ngModule: A11yModule,
19-
providers: [],
20-
};
21-
}
22-
}
14+
export class A11yModule {}

src/lib/core/compatibility/compatibility.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe('Style compatibility', () => {
2626
TestBed.configureTestingModule({
2727
// Specifically do *not* directly import the DefaultStyleCompatibilityModeModule
2828
// to ensure that it is the default behavior.
29-
imports: [MdCheckboxModule.forRoot()],
29+
imports: [MdCheckboxModule],
3030
declarations: [ComponentWithMdCheckbox, ComponentWithMatCheckbox],
3131
});
3232

@@ -45,7 +45,7 @@ describe('Style compatibility', () => {
4545
describe('in no-conflict mode', () => {
4646
beforeEach(async(() => {
4747
TestBed.configureTestingModule({
48-
imports: [MdCheckboxModule.forRoot(), NoConflictStyleCompatibilityMode],
48+
imports: [MdCheckboxModule, NoConflictStyleCompatibilityMode],
4949
declarations: [ComponentWithMdCheckbox, ComponentWithMatCheckbox],
5050
});
5151

@@ -97,7 +97,7 @@ class ComponentWithMatCheckbox { }
9797

9898

9999
@NgModule({
100-
imports: [MdCheckboxModule.forRoot()],
100+
imports: [MdCheckboxModule],
101101
exports: [ComponentWithMdCheckbox, ComponentWithMatCheckbox],
102102
declarations: [ComponentWithMdCheckbox, ComponentWithMatCheckbox],
103103
})

src/lib/core/compatibility/compatibility.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {
22
NgModule,
3-
ModuleWithProviders,
43
Directive,
54
Inject,
65
Optional,
@@ -196,13 +195,6 @@ export class CompatibilityModule {
196195
/** Whether we've done the global sanity checks (e.g. a theme is loaded, there is a doctype). */
197196
private _hasDoneGlobalChecks = false;
198197

199-
static forRoot(): ModuleWithProviders {
200-
return {
201-
ngModule: CompatibilityModule,
202-
providers: [],
203-
};
204-
}
205-
206198
constructor(
207199
@Optional() @Inject(DOCUMENT) private _document: any,
208200
@Optional() @Inject(MATERIAL_SANITY_CHECKS) _sanityChecksEnabled: boolean) {

src/lib/core/core.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {NgModule, ModuleWithProviders} from '@angular/core';
1+
import {NgModule} from '@angular/core';
22
import {MdLineModule} from './line/line';
33
import {RtlModule} from './rtl/dir';
44
import {ObserveContentModule} from './observe-content/observe-content';
@@ -141,12 +141,4 @@ export {MdCommonModule} from './common-behaviors/common-module';
141141
MdSelectionModule,
142142
],
143143
})
144-
export class MdCoreModule {
145-
/** @deprecated */
146-
static forRoot(): ModuleWithProviders {
147-
return {
148-
ngModule: MdCoreModule,
149-
providers: [],
150-
};
151-
}
152-
}
144+
export class MdCoreModule {}

src/lib/core/observe-content/observe-content.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import {
22
Directive,
33
ElementRef,
44
NgModule,
5-
ModuleWithProviders,
65
Output,
76
EventEmitter,
87
OnDestroy,
@@ -45,12 +44,4 @@ export class ObserveContent implements AfterContentInit, OnDestroy {
4544
exports: [ObserveContent],
4645
declarations: [ObserveContent]
4746
})
48-
export class ObserveContentModule {
49-
/** @deprecated */
50-
static forRoot(): ModuleWithProviders {
51-
return {
52-
ngModule: ObserveContentModule,
53-
providers: []
54-
};
55-
}
56-
}
47+
export class ObserveContentModule {}

src/lib/core/option/option.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
Input,
66
Output,
77
NgModule,
8-
ModuleWithProviders,
98
ViewEncapsulation,
109
Inject,
1110
Optional,
@@ -179,11 +178,4 @@ export class MdOption {
179178
exports: [MdOption],
180179
declarations: [MdOption]
181180
})
182-
export class MdOptionModule {
183-
static forRoot(): ModuleWithProviders {
184-
return {
185-
ngModule: MdOptionModule,
186-
providers: []
187-
};
188-
}
189-
}
181+
export class MdOptionModule {}

src/lib/core/overlay/overlay-directives.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe('Overlay directives', () => {
1717

1818
beforeEach(() => {
1919
TestBed.configureTestingModule({
20-
imports: [OverlayModule.forRoot()],
20+
imports: [OverlayModule],
2121
declarations: [ConnectedOverlayDirectiveTest],
2222
providers: [
2323
{provide: OverlayContainer, useFactory: () => {

src/lib/core/overlay/overlay-directives.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {
22
NgModule,
3-
ModuleWithProviders,
43
Directive,
54
EventEmitter,
65
TemplateRef,
@@ -321,12 +320,4 @@ export class ConnectedOverlayDirective implements OnDestroy {
321320
declarations: [ConnectedOverlayDirective, OverlayOrigin, Scrollable],
322321
providers: [OVERLAY_PROVIDERS],
323322
})
324-
export class OverlayModule {
325-
/** @deprecated */
326-
static forRoot(): ModuleWithProviders {
327-
return {
328-
ngModule: OverlayModule,
329-
providers: [],
330-
};
331-
}
332-
}
323+
export class OverlayModule {}

src/lib/core/overlay/overlay.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ describe('Overlay', () => {
1818

1919
beforeEach(async(() => {
2020
TestBed.configureTestingModule({
21-
imports: [OverlayModule.forRoot(), PortalModule, OverlayTestModule],
21+
imports: [OverlayModule, PortalModule, OverlayTestModule],
2222
providers: [
2323
{provide: OverlayContainer, useFactory: () => {
2424
overlayContainerElement = document.createElement('div');

src/lib/core/overlay/scroll/scroll-dispatcher.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('Scroll Dispatcher', () => {
99

1010
beforeEach(async(() => {
1111
TestBed.configureTestingModule({
12-
imports: [OverlayModule.forRoot(), ScrollTestModule],
12+
imports: [OverlayModule, ScrollTestModule],
1313
});
1414

1515
TestBed.compileComponents();

0 commit comments

Comments
 (0)