Skip to content

Commit a0cb75a

Browse files
committed
Add resource loader
1 parent d911e66 commit a0cb75a

6 files changed

Lines changed: 11 additions & 49 deletions

File tree

main.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"start": "npm run build-dev && qode ./dist/src/main.js",
77
"start:prod": "qode ./dist/angular-nodegui/main.js",
88
"build": "ng build",
9-
"build:prod": "ng build --aot",
9+
"build:prod": "ng build",
1010
"build-dev": "ngc -p tsconfig.app.json",
1111
"build-ngtsc": "ngc -p tsconfig.ngtsc.json",
1212
"test": "ng test",

src/app/app.component.ts

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,7 @@ import { AspectRatioMode } from '@nodegui/nodegui';
33

44
@Component({
55
selector: 'app-root',
6-
template: `
7-
<window title="Angular app in window!">
8-
<view>
9-
<image
10-
[src]="'C:/temp/angular.png'"
11-
[aspectRatioMode]="aspectRatioMode"
12-
></image>
13-
<text [style.font-size.px]="45">Hello, {{ name }}</text>
14-
<checkbox [checked]="true"></checkbox>
15-
<checkbox [checked]="true" [enabled]="false"></checkbox>
16-
<button [style.background-color]="'green'" (clicked)="setName()">
17-
Green button
18-
</button>
19-
<linedit
20-
[text]="name"
21-
[placeholderText]="'Insert your name'"
22-
(textChanged)="textChanged($event)"
23-
></linedit>
24-
<progressbar [value]="40" [minimum]="0" [maximum]="100"></progressbar>
25-
<spinbox
26-
[prefix]="'aa'"
27-
[suffix]="'bb'"
28-
[singleStep]="10"
29-
[range]="{ minimum: 0, maximum: 50 }"
30-
[value]="20"
31-
>
32-
</spinbox>
33-
</view>
34-
</window>
35-
`
36-
// templateUrl: './app.component.html'
6+
templateUrl: './app.component.html'
377
})
388
export class AppComponent {
399
public name = 'World!';
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ export class FileSystemResourceLoader extends ResourceLoader {
1414
}
1515

1616
get(url: string): Promise<string> {
17-
const appDir = path.join(__dirname);
17+
// TODO: Load real app dir
18+
const appDir = path.join(__dirname, '../../../src/app');
1819
const templatePath = this.resolve(url, appDir);
1920

2021
return new Promise((resolve, reject) => {

src/lib/platform-dynamic.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { ElementSchemaRegistry, ResourceLoader } from '@angular/compiler';
99

1010
import { NodeguiElementSchemaRegistry } from './schema-registry';
1111
import { NodeguiSanitizer } from './sanitizer';
12-
// import { FileSystemResourceLoader } from './file-system-resource-loader';
12+
import { FileSystemResourceLoader } from './file-system-resource-loader';
1313

1414
export const platformNodeguiDynamic = createPlatformFactory(
1515
platformCoreDynamic,
@@ -25,12 +25,12 @@ export const platformNodeguiDynamic = createPlatformFactory(
2525
provide: ElementSchemaRegistry,
2626
useClass: NodeguiElementSchemaRegistry,
2727
deps: []
28+
},
29+
{
30+
provide: ResourceLoader,
31+
useClass: FileSystemResourceLoader,
32+
deps: []
2833
}
29-
// {
30-
// provide: ResourceLoader,
31-
// useClass: FileSystemResourceLoader,
32-
// deps: []
33-
// }
3434
]
3535
},
3636
multi: true

tsconfig.aot.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"extends": "./tsconfig.json",
33
"compilerOptions": {
44
"outDir": "./dist",
5-
"module": "commonjs"
5+
"module": "esnext"
66
},
77
"files": ["src/main-aot.ts"],
88
"include": ["src/**/*.ts"],

0 commit comments

Comments
 (0)