feat(compiler): Add a enableLegacyTemplate option to support <template>

When the `enableLegacyTemplate` is set to `false`, `<template>` tags and the
`template` attribute are no more used to define angular templates but are
treated as regular tag and attribute.

The default value is `true`.

In order to define a template, you have to use the `<ng-template>` tag.

This option applies to your application and all the libraries it uses. That is
you should make sure none of them rely on the legacy way to defined templates
when this option is turned off (`false`).
This commit is contained in:
Victor Berchet
2017-01-10 19:07:03 -08:00
committed by Igor Minar
parent bf8eb41248
commit e99d721612
10 changed files with 85 additions and 19 deletions

View File

@ -104,7 +104,6 @@ export const COMPILER_PROVIDERS: Array<any|Type<any>|{[k: string]: any}|any[]> =
AnimationParser,
];
@CompilerInjectable()
export class JitCompilerFactory implements CompilerFactory {
private _defaultOptions: CompilerOptions[];
@ -136,7 +135,8 @@ export class JitCompilerFactory implements CompilerFactory {
// from the app providers
defaultEncapsulation: opts.defaultEncapsulation,
logBindingUpdate: opts.useDebug,
missingTranslation: opts.missingTranslation, useViewEngine
missingTranslation: opts.missingTranslation, useViewEngine,
enableLegacyTemplate: opts.enableLegacyTemplate,
});
},
deps: [USE_VIEW_ENGINE]