Skip to content

Commit

Permalink
AoT working again
Browse files Browse the repository at this point in the history
  • Loading branch information
udos86 committed Feb 19, 2017
1 parent 651efeb commit 13c7744
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
15 changes: 7 additions & 8 deletions example/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,12 @@ import { ValidationMessageComponent } from "./validation-message/validation-mess
import { AppRoutingModule } from './app.routing.module';
import { AppComponent } from './app.component';

export function testValidator(formControl: FormControl) {
export function customValidator(formControl: FormControl) {
return {customValidator: {valid: formControl.value ? (formControl.value as string).startsWith("abc") : false}};
}

return {
testValidator: {
valid: formControl.value ? <string>formControl.value.startsWith("abc") : false
}
};
export function mockBackendFactory(mockBackend: MockBackend, baseRequestOptions: BaseRequestOptions) {
return new Http(mockBackend, baseRequestOptions)
}

@NgModule({
Expand Down Expand Up @@ -69,15 +68,15 @@ export function testValidator(formControl: FormControl) {
{
provide: Http,
deps: [MockBackend, BaseRequestOptions],
useFactory: (backend, options) => new Http(backend, options)
useFactory: mockBackendFactory
},
{
provide: LocationStrategy,
useClass: HashLocationStrategy
},
{
provide: NG_VALIDATORS,
useValue: testValidator,
useValue: customValidator,
multi: true
}
],
Expand Down
6 changes: 3 additions & 3 deletions example/app/main.aot.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//import { platformBrowser } from "@angular/platform-browser";
//import { AppModuleNgFactory } from "../aot/example/app/app.module.ngfactory";
import { platformBrowser } from "@angular/platform-browser";
import { AppModuleNgFactory } from "../aot/example/app/app.module.ngfactory";

//platformBrowser().bootstrapModuleFactory(AppModuleNgFactory);
platformBrowser().bootstrapModuleFactory(AppModuleNgFactory);
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@
"scripts": {
"compile:app:aot": "ngc -p tsconfig.aot.json",
"bundle:app:rollup": "tsc -p tsconfig.aot.json && rollup -c rollup.config.js",
"bundle:app:webpack": "tsc && webpack --config ./webpack.config.js",
"bundle:app:webpack": "webpack --config ./webpack.config.js",
"build:modules": "gulp build:modules",
"ci:build": "gulp build:modules",
"ci:test": "karma start karma.config.js --single-run",
"ci:tsc": "tsc && echo ok || echo not ok",
"gulp": "gulp",
"karma": "karma start karma.config.js",
"start": "tsc && lite-server -c browsersync.config.js",
"start": "lite-server -c browsersync.config.js",
"tests:e2e": "protractor protractor.config.js",
"tests:unit": "karma start karma.config.js --single-run",
"tsc": "tsc -watch",
"tsc": "tsc",
"tsc:watch": "tsc -watch",
"tslint": "tslint -c ./tslint.json",
"watch": "gulp watch:modules",
"webdriver:start": "webdriver-manager start",
Expand Down

0 comments on commit 13c7744

Please sign in to comment.