Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(api): remove use of static ngModule.forRoot() #167

Merged
merged 1 commit into from
Feb 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/demo-app/app/demo-app-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { DemosResponsiveLayoutsModule } from './docs-layout-responsive/DemosResp
imports : [
BrowserModule,
MaterialModule.forRoot(),
FlexLayoutModule.forRoot(),
FlexLayoutModule,
DemoAppRoutingModule,

/* Internal Demo App Modules */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import {DemoResponsiveFlexOrder} from "./responsiveFlexOrder.demo";
CommonModule,
FormsModule,
MaterialModule,
FlexLayoutModule.forRoot()
FlexLayoutModule
]

})
Expand Down
12 changes: 5 additions & 7 deletions src/lib/flexbox/_module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
import 'rxjs/add/operator/filter';
import 'rxjs/add/operator/map';

import {ModuleWithProviders, NgModule} from '@angular/core';
import {NgModule} from '@angular/core';

import {MediaMonitor} from '../media-query/media-monitor';
import {MediaQueriesModule} from '../media-query/_module';

import {FlexDirective} from './api/flex';
import {LayoutDirective} from './api/layout';
import {HideDirective} from './api/hide';
Expand Down Expand Up @@ -52,10 +54,6 @@ const ALL_DIRECTIVES = [
declarations: ALL_DIRECTIVES,
imports: [MediaQueriesModule],
exports: [MediaQueriesModule, ...ALL_DIRECTIVES],
providers: []
providers: [ MediaMonitor ]
})
export class FlexLayoutModule {
static forRoot(): ModuleWithProviders {
return {ngModule: FlexLayoutModule, providers: [MediaMonitor]};
}
}
export class FlexLayoutModule { }
2 changes: 1 addition & 1 deletion src/lib/flexbox/api/flex.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('flex directive', () => {

// Configure testbed to prepare services
TestBed.configureTestingModule({
imports: [CommonModule, FlexLayoutModule.forRoot()],
imports: [CommonModule, FlexLayoutModule],
declarations: [TestFlexComponent],
providers: [
BreakPointRegistry, BreakPointsProvider,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/flexbox/api/hide.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('hide directive', () => {

// Configure testbed to prepare services
TestBed.configureTestingModule({
imports: [CommonModule, MediaQueriesModule.forRoot()],
imports: [CommonModule, MediaQueriesModule],
declarations: [TestHideComponent, HideDirective],
providers: [
BreakPointRegistry, BreakPointsProvider,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/flexbox/api/layout-align.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('layout-align directive', () => {

// Configure testbed to prepare services
TestBed.configureTestingModule({
imports: [CommonModule, FlexLayoutModule.forRoot()],
imports: [CommonModule, FlexLayoutModule],
declarations: [TestLayoutAlignComponent],
providers: [
BreakPointRegistry, BreakPointsProvider,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/flexbox/api/layout-gap.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('layout-gap directive', () => {

// Configure testbed to prepare services
TestBed.configureTestingModule({
imports: [CommonModule, FlexLayoutModule.forRoot()],
imports: [CommonModule, FlexLayoutModule],
declarations: [TestLayoutGapComponent],
providers: [
BreakPointRegistry, BreakPointsProvider,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/flexbox/api/layout.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('layout directive', () => {

// Configure testbed to prepare services
TestBed.configureTestingModule({
imports: [CommonModule, FlexLayoutModule.forRoot()],
imports: [CommonModule, FlexLayoutModule],
declarations: [TestLayoutComponent],
providers: [
BreakPointRegistry, BreakPointsProvider,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/flexbox/api/show.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('show directive', () => {

// Configure testbed to prepare services
TestBed.configureTestingModule({
imports: [CommonModule, FlexLayoutModule.forRoot()],
imports: [CommonModule, FlexLayoutModule],
declarations: [TestShowComponent],
providers: [
BreakPointRegistry, BreakPointsProvider,
Expand Down
13 changes: 3 additions & 10 deletions src/lib/media-query/_module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {NgModule, ModuleWithProviders} from '@angular/core';
import {NgModule} from '@angular/core';

import {MatchMedia} from './match-media';
import {MediaMonitor} from './media-monitor';
import {ObservableMediaProvider} from './observable-media-service';
import {BreakPointsProvider} from './breakpoints/break-points';
import {BreakPointRegistry} from './breakpoints/break-point-registry';



/**
* *****************************************************************
* Define module for the MediaQuery API
Expand All @@ -24,18 +22,13 @@ import {BreakPointRegistry} from './breakpoints/break-point-registry';
@NgModule({
providers: [
MatchMedia, // Low-level service to publish observables w/ window.matchMedia()
MediaMonitor, // MediaQuery monitor service observes all known breakpoints
BreakPointRegistry, // Registry of known/used BreakPoint(s)
BreakPointsProvider, // Supports developer overrides of list of known breakpoints
BreakPointRegistry, // Registry of known/used BreakPoint(s)
MediaMonitor, // MediaQuery monitor service observes all known breakpoints
ObservableMediaProvider // easy subscription injectable `media$` matchMedia observable
]
})
export class MediaQueriesModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: MediaQueriesModule
};
}
}