Skip to content

Commit

Permalink
fix: lint and aot errors
Browse files Browse the repository at this point in the history
  • Loading branch information
crisbeto committed Jun 27, 2017
1 parent 73d7a46 commit 4044645
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 38 deletions.
60 changes: 30 additions & 30 deletions src/lib/core/portal/portal-injector.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* 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 {Injector} from '@angular/core';

/**
* Custom injector to be used when providing custom
* injection tokens to components inside a portal.
* @docs-private
*/
export class PortalInjector implements Injector {
constructor(
private _parentInjector: Injector,
private _customTokens: WeakMap<any, any>) { }

get(token: any, notFoundValue?: any): any {
const value = this._customTokens.get(token);

if (typeof value !== 'undefined') {
return value;
}

return this._parentInjector.get<any>(token, notFoundValue);
}
}
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* 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 {Injector} from '@angular/core';

/**
* Custom injector to be used when providing custom
* injection tokens to components inside a portal.
* @docs-private
*/
export class PortalInjector implements Injector {
constructor(
private _parentInjector: Injector,
private _customTokens: WeakMap<any, any>) { }

get(token: any, notFoundValue?: any): any {
const value = this._customTokens.get(token);

if (typeof value !== 'undefined') {
return value;
}

return this._parentInjector.get<any>(token, notFoundValue);
}
}
10 changes: 8 additions & 2 deletions src/lib/snack-bar/simple-snack-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
*/

import {Component, ViewEncapsulation, Inject} from '@angular/core';
import {MdSnackBarRef, MD_SNACK_BAR_DATA} from './index';
import {MdSnackBarRef} from './snack-bar-ref';
import {MD_SNACK_BAR_DATA} from './snack-bar-config';


/**
Expand All @@ -25,9 +26,14 @@ import {MdSnackBarRef, MD_SNACK_BAR_DATA} from './index';
}
})
export class SimpleSnackBar {
/** Data that was injected into the snack bar. */
data: { message: string, action: string };

constructor(
public snackBarRef: MdSnackBarRef<SimpleSnackBar>,
@Inject(MD_SNACK_BAR_DATA) public data: { message: string, action: string }) { }
@Inject(MD_SNACK_BAR_DATA) data: any) {
this.data = data;
}

/** Dismisses the snack bar. */
dismiss(): void {
Expand Down
4 changes: 3 additions & 1 deletion src/lib/snack-bar/snack-bar-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
* found in the LICENSE file at https://angular.io/license
*/

import {ViewContainerRef} from '@angular/core';
import {ViewContainerRef, InjectionToken} from '@angular/core';
import {AriaLivePoliteness, Direction} from '../core';

export const MD_SNACK_BAR_DATA = new InjectionToken<any>('MdSnackBarData');

/**
* Configuration used when opening a snack-bar.
*/
Expand Down
2 changes: 0 additions & 2 deletions src/lib/snack-bar/snack-bar-ref.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import {Observable} from 'rxjs/Observable';
import {Subject} from 'rxjs/Subject';
import {MdSnackBarContainer} from './snack-bar-container';

// TODO(josephperrott): Implement onAction observable.

/**
* Reference to a snack bar dispatched from the snack bar service.
*/
Expand Down
7 changes: 4 additions & 3 deletions src/lib/snack-bar/snack-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
Optional,
SkipSelf,
Injector,
InjectionToken,
} from '@angular/core';
import {
ComponentType,
Expand All @@ -23,10 +22,12 @@ import {
LiveAnnouncer,
} from '../core';
import {PortalInjector} from '../core/portal/portal-injector';
import {MdSnackBarConfig, MdSnackBarRef, MdSnackBarContainer, SimpleSnackBar} from './index';
import {extendObject} from '../core/util/object-extend';
import {MdSnackBarConfig, MD_SNACK_BAR_DATA} from './snack-bar-config';
import {MdSnackBarRef} from './snack-bar-ref';
import {MdSnackBarContainer} from './snack-bar-container';
import {SimpleSnackBar} from './simple-snack-bar';

export const MD_SNACK_BAR_DATA = new InjectionToken<any>('MdSnackBarData');

/**
* Service to dispatch Material Design snack bar messages.
Expand Down

0 comments on commit 4044645

Please sign in to comment.