Skip to content

Commit 84e0079

Browse files
authored
chore: make the library ready for offline compile (#738)
1 parent e10172c commit 84e0079

File tree

18 files changed

+71
-25
lines changed

18 files changed

+71
-25
lines changed

src/components/checkbox/checkbox.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ let nextId = 0;
2222
* Provider Expression that allows md-checkbox to register as a ControlValueAccessor. This allows it
2323
* to support [(ngModel)] and ngControl.
2424
*/
25-
const MD_CHECKBOX_CONTROL_VALUE_ACCESSOR = new Provider(
25+
export const MD_CHECKBOX_CONTROL_VALUE_ACCESSOR = new Provider(
2626
NG_VALUE_ACCESSOR, {
2727
useExisting: forwardRef(() => MdCheckbox),
2828
multi: true

src/components/input/input.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ import {
1818
} from '@angular/core';
1919
import {
2020
NG_VALUE_ACCESSOR,
21-
ControlValueAccessor
21+
ControlValueAccessor,
22+
NgModel,
23+
NgIf,
2224
} from '@angular/common';
2325
import {BooleanFieldValue} from '@angular2-material/core/annotations/field-value';
2426
import {MdError} from '@angular2-material/core/errors/error';
@@ -27,7 +29,7 @@ import {Observable} from 'rxjs/Observable';
2729

2830
const noop = () => {};
2931

30-
const MD_INPUT_CONTROL_VALUE_ACCESSOR = new Provider(NG_VALUE_ACCESSOR, {
32+
export const MD_INPUT_CONTROL_VALUE_ACCESSOR = new Provider(NG_VALUE_ACCESSOR, {
3133
useExisting: forwardRef(() => MdInput),
3234
multi: true
3335
});
@@ -97,6 +99,7 @@ export class MdHint {
9799
templateUrl: 'input.html',
98100
styleUrls: ['input.css'],
99101
providers: [MD_INPUT_CONTROL_VALUE_ACCESSOR],
102+
directives: [NgIf, NgModel],
100103
host: {'(click)' : 'focus()'}
101104
})
102105
export class MdInput implements ControlValueAccessor, AfterContentInit, OnChanges {

src/components/progress-bar/progress-bar.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
HostBinding,
55
Input,
66
} from '@angular/core';
7-
7+
import {NgStyle} from '@angular/common';
88

99
// TODO(josephperrott): Benchpress tests.
1010
// TODO(josephperrott): Add ARIA attributes for progressbar "for".
@@ -24,6 +24,7 @@ import {
2424
templateUrl: 'progress-bar.html',
2525
styleUrls: ['progress-bar.css'],
2626
changeDetection: ChangeDetectionStrategy.OnPush,
27+
directives: [NgStyle],
2728
})
2829
export class MdProgressBar {
2930
/** Value of the progressbar. Defaults to zero. Mirrored to aria-valuenow. */

src/components/radio/radio.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export {
3434
* Provider Expression that allows md-radio-group to register as a ControlValueAccessor. This
3535
* allows it to support [(ngModel)] and ngControl.
3636
*/
37-
const MD_RADIO_GROUP_CONTROL_VALUE_ACCESSOR = new Provider(
37+
export const MD_RADIO_GROUP_CONTROL_VALUE_ACCESSOR = new Provider(
3838
NG_VALUE_ACCESSOR, {
3939
useExisting: forwardRef(() => MdRadioGroup),
4040
multi: true

src/components/sidenav/sidenav.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
EventEmitter,
1313
Renderer
1414
} from '@angular/core';
15+
import {NgStyle} from '@angular/common';
1516
import {Dir} from '@angular2-material/core/rtl/dir';
1617
import {PromiseCompleter} from '@angular2-material/core/async/promise-completer';
1718
import {MdError} from '@angular2-material/core/errors/error';
@@ -231,7 +232,7 @@ export class MdSidenav {
231232
// Do not use ChangeDetectionStrategy.OnPush. It does not work for this component because
232233
// technically it is a sibling of MdSidenav (on the content tree) and isn't updated when MdSidenav
233234
// changes its state.
234-
directives: [MdSidenav],
235+
directives: [MdSidenav, NgStyle],
235236
templateUrl: 'sidenav.html',
236237
styleUrls: [
237238
'sidenav.css',

src/components/tabs/tabs.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ import {
66
Output,
77
ViewChildren,
88
NgZone,
9-
EventEmitter
9+
EventEmitter,
10+
QueryList,
11+
ContentChildren
1012
} from '@angular/core';
11-
import {QueryList} from '@angular/core';
12-
import {ContentChildren} from '@angular/core';
13+
import {NgIf, NgFor} from '@angular/common';
1314
import {PortalHostDirective} from '@angular2-material/core/portal/portal-directives';
1415
import {MdTabLabel} from './tab-label';
1516
import {MdTabContent} from './tab-content';
@@ -45,7 +46,7 @@ export class MdTab {
4546
selector: 'md-tab-group',
4647
templateUrl: 'tab-group.html',
4748
styleUrls: ['tab-group.css'],
48-
directives: [PortalHostDirective, MdTabLabelWrapper, MdInkBar],
49+
directives: [PortalHostDirective, MdTabLabelWrapper, MdInkBar, NgIf, NgFor],
4950
})
5051
export class MdTabGroup {
5152
/** @internal */

src/core/a11y/live-announcer.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ export class MdLiveAnnouncer {
1414

1515
private _liveElement: Element;
1616

17-
constructor(@Optional() @Inject(LIVE_ANNOUNCER_ELEMENT_TOKEN) elementToken: Element) {
17+
constructor(@Optional() @Inject(LIVE_ANNOUNCER_ELEMENT_TOKEN) elementToken: any) {
18+
19+
// We inject the live element as `any` because the constructor signature cannot reference
20+
// browser globals (HTMLElement) on non-browser environments, since having a class decorator
21+
// causes TypeScript to preserve the constructor signature types.
1822
this._liveElement = elementToken || this._createLiveElement();
1923
}
2024

src/core/overlay/overlay.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,17 @@ let defaultState = new OverlayState();
3232
*/
3333
@Injectable()
3434
export class Overlay {
35+
private _overlayContainerElement: HTMLElement;
36+
3537
constructor(
36-
@Inject(OVERLAY_CONTAINER_TOKEN) private _overlayContainerElement: HTMLElement,
38+
@Inject(OVERLAY_CONTAINER_TOKEN) overlayContainerElement: any,
3739
private _componentResolver: ComponentResolver,
3840
private _positionBuilder: OverlayPositionBuilder) {
41+
42+
// We inject the container as `any` because the constructor signature cannot reference
43+
// browser globals (HTMLElement) on non-browser environments, since having a class decorator
44+
// causes TypeScript to preserve the constructor signature types.
45+
this._overlayContainerElement = overlayContainerElement;
3946
}
4047

4148
/**

src/demo-app/checkbox/checkbox-demo.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import {Component} from '@angular/core';
2-
import {FORM_DIRECTIVES} from '@angular/common';
2+
import {NgFor, FORM_DIRECTIVES} from '@angular/common';
33
import {MdCheckbox} from '@angular2-material/checkbox/checkbox';
44

5-
interface Task {
5+
export interface Task {
66
name: string;
77
completed: boolean;
88
subtasks?: Task[];
@@ -17,9 +17,9 @@ interface Task {
1717
}
1818
`],
1919
templateUrl: 'nested-checklist.html',
20-
directives: [MdCheckbox]
20+
directives: [MdCheckbox, NgFor]
2121
})
22-
class MdCheckboxDemoNestedChecklist {
22+
export class MdCheckboxDemoNestedChecklist {
2323
tasks: Task[] = [
2424
{
2525
name: 'Reminders',

src/demo-app/grid-list/grid-list-demo.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {Component} from '@angular/core';
2+
import {NgFor, FORM_DIRECTIVES} from '@angular/common';
23
import {MD_GRID_LIST_DIRECTIVES} from '@angular2-material/grid-list/grid-list';
34
import {MdButton} from '@angular2-material/button/button';
45
import {MD_CARD_DIRECTIVES} from '@angular2-material/card/card';
@@ -9,7 +10,14 @@ import {MdIcon, MdIconRegistry} from '@angular2-material/icon/icon';
910
selector: 'grid-list-demo',
1011
templateUrl: 'grid-list-demo.html',
1112
styleUrls: ['grid-list-demo.css'],
12-
directives: [MD_GRID_LIST_DIRECTIVES, MdButton, MD_CARD_DIRECTIVES, MdIcon],
13+
directives: [
14+
MD_GRID_LIST_DIRECTIVES,
15+
MdButton,
16+
MD_CARD_DIRECTIVES,
17+
MdIcon,
18+
FORM_DIRECTIVES,
19+
NgFor,
20+
],
1321
providers: [MdIconRegistry]
1422
})
1523
export class GridListDemo {

0 commit comments

Comments
 (0)