Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit dbba91c

Browse files
committed
fix(AoT): using exported functions problems for module providers.
1 parent d241d9d commit dbba91c

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

‎nativescript-angular/platform-providers.ts‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { topmost, Frame } from "ui/frame";
22
import { Page } from "ui/page";
33
import { OpaqueToken } from "@angular/core";
4-
import { device } from "platform";
4+
import { device,Device } from "platform";
55
import * as platform from "platform";
66

77
export const APP_ROOT_VIEW = new OpaqueToken("App Root View");
@@ -15,6 +15,7 @@ if (global.___TS_UNUSED) {
1515
})();
1616
}
1717

18+
// Use an exported function to make the AoT compiler happy.
1819
export function getDefaultPage(): Page {
1920
const frame = topmost();
2021
if (frame) {
@@ -23,11 +24,22 @@ export function getDefaultPage(): Page {
2324
return null;
2425
}
2526
}
27+
2628
export const defaultPageProvider = { provide: Page, useFactory: getDefaultPage };
2729

28-
export const defaultFrameProvider = { provide: Frame, useFactory: topmost };
30+
// Use an exported function to make the AoT compiler happy.
31+
export function getDefaultFrame(): Frame {
32+
return topmost();
33+
}
34+
35+
export const defaultFrameProvider = { provide: Frame, useFactory: getDefaultFrame };
36+
37+
// Use an exported function to make the AoT compiler happy.
38+
export function getDefaultDevice(): Device {
39+
return device;
40+
}
2941

30-
export const defaultDeviceProvider = { provide: DEVICE, useValue: device };
42+
export const defaultDeviceProvider = { provide: DEVICE, useFactory: getDefaultDevice };
3143

3244
export type PageFactory = (options: PageFactoryOptions) => Page;
3345
export interface PageFactoryOptions {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /