fix(compiler): make I18NHtmlParser provider AoT-compliant (#15980)

PR Close #15980
This commit is contained in:
David 2017-04-14 10:37:32 +02:00 committed by Miško Hevery
parent 11b0213d20
commit 745731e1a3
1 changed files with 8 additions and 4 deletions

View File

@ -38,6 +38,13 @@ const _NO_RESOURCE_LOADER: ResourceLoader = {
const baseHtmlParser = new InjectionToken('HtmlParser'); const baseHtmlParser = new InjectionToken('HtmlParser');
export function i18nHtmlParserFactory(
parser: HtmlParser, translations: string, format: string, config: CompilerConfig,
console: Console): i18n.I18NHtmlParser {
return new i18n.I18NHtmlParser(
parser, translations, format, config.missingTranslation !, console);
}
/** /**
* A set of providers that provide `JitCompiler` and its dependencies to use for * A set of providers that provide `JitCompiler` and its dependencies to use for
* template compilation. * template compilation.
@ -56,10 +63,7 @@ export const COMPILER_PROVIDERS: Array<any|Type<any>|{[k: string]: any}|any[]> =
}, },
{ {
provide: i18n.I18NHtmlParser, provide: i18n.I18NHtmlParser,
useFactory: (parser: HtmlParser, translations: string, format: string, config: CompilerConfig, useFactory: i18nHtmlParserFactory,
console: Console) =>
new i18n.I18NHtmlParser(
parser, translations, format, config.missingTranslation !, console),
deps: [ deps: [
baseHtmlParser, baseHtmlParser,
[new Optional(), new Inject(TRANSLATIONS)], [new Optional(), new Inject(TRANSLATIONS)],