feat(compiler): set enableLegacyTemplate
to false by default (#18756)
BREAKING CHANGE: the compiler option `enableLegacyTemplate` is now disabled by default as the `<template>` element has been deprecated since v4. Use `<ng-template>` instead. The option `enableLegacyTemplate` and the `<template>` element will both be removed in Angular v6. PR Close #18756
This commit is contained in:

committed by
Jason Aden

parent
fcadeb2079
commit
56238fe94e
@ -55,11 +55,6 @@
|
||||
</ng-template>
|
||||
<!-- #enddocregion ngif-template -->
|
||||
|
||||
<p>template attribute</p>
|
||||
<!-- #docregion ngif-template-attr -->
|
||||
<div template="ngIf hero">{{hero.name}}</div>
|
||||
<!-- #enddocregion ngif-template-attr -->
|
||||
|
||||
<hr>
|
||||
|
||||
<h2 id="ng-container"><ng-container></h2>
|
||||
@ -131,14 +126,7 @@
|
||||
</div>
|
||||
|
||||
<!--#enddocregion inside-ngfor -->
|
||||
<p class="code"><div template="ngFor let hero of heroes; let i=index; let odd=odd; trackBy: trackById" [class.odd]="odd"></p>
|
||||
<!--#docregion inside-ngfor -->
|
||||
<div template="ngFor let hero of heroes; let i=index; let odd=odd; trackBy: trackById" [class.odd]="odd">
|
||||
({{i}}) {{hero.name}}
|
||||
</div>
|
||||
|
||||
<!--#enddocregion inside-ngfor -->
|
||||
<p class="code"><template ngFor let-hero [ngForOf]="heroes" let-i="index" let-odd="odd" [ngForTrackBy]="trackById"></p>
|
||||
<p class="code"><ng-template ngFor let-hero [ngForOf]="heroes" let-i="index" let-odd="odd" [ngForTrackBy]="trackById"/></p>
|
||||
<!--#docregion inside-ngfor -->
|
||||
<ng-template ngFor let-hero [ngForOf]="heroes" let-i="index" let-odd="odd" [ngForTrackBy]="trackById">
|
||||
<div [class.odd]="odd">({{i}}) {{hero.name}}</div>
|
||||
@ -169,16 +157,6 @@
|
||||
</div>
|
||||
<!-- #enddocregion built-in, ngswitch -->
|
||||
|
||||
<h4>NgSwitch with <i>template</i> attribute</h4>
|
||||
<!-- #docregion ngswitch-template-attr -->
|
||||
<div [ngSwitch]="hero?.emotion">
|
||||
<happy-hero template="ngSwitchCase 'happy'" [hero]="hero"></happy-hero>
|
||||
<sad-hero template="ngSwitchCase 'sad'" [hero]="hero"></sad-hero>
|
||||
<confused-hero template="ngSwitchCase 'confused'" [hero]="hero"></confused-hero>
|
||||
<unknown-hero template="ngSwitchDefault" [hero]="hero"></unknown-hero>
|
||||
</div>
|
||||
<!-- #enddocregion ngswitch-template-attr -->
|
||||
|
||||
<h4>NgSwitch with <ng-template></h4>
|
||||
<!-- #docregion ngswitch-template -->
|
||||
<div [ngSwitch]="hero?.emotion">
|
||||
@ -199,7 +177,7 @@
|
||||
|
||||
<hr>
|
||||
|
||||
<h2><template></h2>
|
||||
<h2><ng-template></h2>
|
||||
<!-- #docregion template-tag -->
|
||||
<p>Hip!</p>
|
||||
<ng-template>
|
||||
@ -238,13 +216,13 @@
|
||||
<p *myUnless="condition">Show this sentence unless the condition is true.</p>
|
||||
<!-- #enddocregion myUnless-1 -->
|
||||
|
||||
<p template="myUnless condition" class="code unless">
|
||||
(A) <p template="myUnless condition" class="code unless">
|
||||
<p *myUnless="condition" class="code unless">
|
||||
(A) <p *myUnless="condition" class="code unless">
|
||||
</p>
|
||||
|
||||
<ng-template [myUnless]="condition">
|
||||
<p class="code unless">
|
||||
(A) <template [myUnless]="condition">
|
||||
(A) <ng-template [myUnless]="condition">
|
||||
</p>
|
||||
</ng-template>
|
||||
|
||||
|
@ -19,8 +19,7 @@ import { Directive, Input, TemplateRef, ViewContainerRef } from '@angular/core';
|
||||
* ### Syntax
|
||||
*
|
||||
* - `<div *myUnless="condition">...</div>`
|
||||
* - `<div template="myUnless condition">...</div>`
|
||||
* - `<template [myUnless]="condition"><div>...</div></template>`
|
||||
* - `<ng-template [myUnless]="condition"><div>...</div></ng-template>`
|
||||
*
|
||||
// #docregion no-docs
|
||||
*/
|
||||
|
Reference in New Issue
Block a user