Skip to content

Commit

Permalink
fix(snack-bar): SimpleSnackBar not being exported (#3016)
Browse files Browse the repository at this point in the history
* Fixes the `SimpleSnackBar` class not being exported.
* Moves the `MdSnackBarModule` to the `index.ts` for consistency with other modules.

Fixes #3010.
  • Loading branch information
crisbeto authored and tinayuangao committed Feb 9, 2017
1 parent 1a854e7 commit a7a3967
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 35 deletions.
2 changes: 1 addition & 1 deletion src/lib/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {MdIconModule} from './icon/index';
import {MdProgressSpinnerModule} from './progress-spinner/index';
import {MdProgressBarModule} from './progress-bar/index';
import {MdInputModule} from './input/index';
import {MdSnackBarModule} from './snack-bar/snack-bar';
import {MdSnackBarModule} from './snack-bar/index';
import {MdTabsModule} from './tabs/index';
import {MdToolbarModule} from './toolbar/index';
import {MdTooltipModule} from './tooltip/index';
Expand Down
25 changes: 25 additions & 0 deletions src/lib/snack-bar/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,29 @@
import {NgModule, ModuleWithProviders} from '@angular/core';
import {OverlayModule, PortalModule, CompatibilityModule, LIVE_ANNOUNCER_PROVIDER} from '../core';
import {CommonModule} from '@angular/common';
import {MdSnackBar} from './snack-bar';
import {MdSnackBarContainer} from './snack-bar-container';
import {SimpleSnackBar} from './simple-snack-bar';

@NgModule({
imports: [OverlayModule, PortalModule, CommonModule, CompatibilityModule],
exports: [MdSnackBarContainer, CompatibilityModule],
declarations: [MdSnackBarContainer, SimpleSnackBar],
entryComponents: [MdSnackBarContainer, SimpleSnackBar],
providers: [MdSnackBar, LIVE_ANNOUNCER_PROVIDER]
})
export class MdSnackBarModule {
/** @deprecated */
static forRoot(): ModuleWithProviders {
return {
ngModule: MdSnackBarModule,
providers: []
};
}
}

export * from './snack-bar';
export * from './snack-bar-container';
export * from './snack-bar-config';
export * from './snack-bar-ref';
export * from './simple-snack-bar';
4 changes: 1 addition & 3 deletions src/lib/snack-bar/snack-bar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ import {
} from '@angular/core/testing';
import {NgModule, Component, Directive, ViewChild, ViewContainerRef} from '@angular/core';
import {CommonModule} from '@angular/common';
import {MdSnackBar, MdSnackBarModule} from './snack-bar';
import {MdSnackBarConfig} from './snack-bar-config';
import {MdSnackBarModule, MdSnackBar, MdSnackBarConfig, SimpleSnackBar} from './index';
import {OverlayContainer, LiveAnnouncer} from '../core';
import {SimpleSnackBar} from './simple-snack-bar';


// TODO(josephperrott): Update tests to mock waiting for time to complete for animations.
Expand Down
32 changes: 1 addition & 31 deletions src/lib/snack-bar/snack-bar.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,12 @@
import {
NgModule,
ModuleWithProviders,
Injectable,
ComponentRef,
Optional,
SkipSelf,
} from '@angular/core';
import {Injectable, ComponentRef, Optional, SkipSelf} from '@angular/core';
import {
ComponentType,
ComponentPortal,
Overlay,
OverlayModule,
OverlayRef,
OverlayState,
PortalModule,
LiveAnnouncer,
CompatibilityModule,
LIVE_ANNOUNCER_PROVIDER,
} from '../core';
import {CommonModule} from '@angular/common';
import {MdSnackBarConfig} from './snack-bar-config';
import {MdSnackBarRef} from './snack-bar-ref';
import {MdSnackBarContainer} from './snack-bar-container';
Expand Down Expand Up @@ -160,21 +148,3 @@ export class MdSnackBar {
function _applyConfigDefaults(config: MdSnackBarConfig): MdSnackBarConfig {
return extendObject(new MdSnackBarConfig(), config);
}


@NgModule({
imports: [OverlayModule, PortalModule, CommonModule, CompatibilityModule],
exports: [MdSnackBarContainer, CompatibilityModule],
declarations: [MdSnackBarContainer, SimpleSnackBar],
entryComponents: [MdSnackBarContainer, SimpleSnackBar],
providers: [MdSnackBar, LIVE_ANNOUNCER_PROVIDER]
})
export class MdSnackBarModule {
/** @deprecated */
static forRoot(): ModuleWithProviders {
return {
ngModule: MdSnackBarModule,
providers: []
};
}
}

0 comments on commit a7a3967

Please sign in to comment.