612 lines
		
	
	
		
			17 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
		
		
			
		
	
	
			612 lines
		
	
	
		
			17 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
|  | <html lang="en"><head></head><body><form id="mainForm" method="post" action="http://plnkr.co/edit/?p=preview" target="_self"><input type="hidden" name="files[app/app.component.ts]" value="import { Component } from '@angular/core'; | ||
|  | 
 | ||
|  | import { Hero, heroes } from './hero'; | ||
|  | 
 | ||
|  | @Component({ | ||
|  |   moduleId: module.id, | ||
|  |   selector: 'my-app', | ||
|  |   templateUrl: './app.component.html', | ||
|  |   styleUrls: [ './app.component.css' ] | ||
|  | }) | ||
|  | export class AppComponent { | ||
|  |   heroes = heroes; | ||
|  |   hero = this.heroes[0]; | ||
|  | 
 | ||
|  |   condition = false; | ||
|  |   logs: string[] = []; | ||
|  |   showSad = true; | ||
|  |   status = 'ready'; | ||
|  | 
 | ||
|  |   trackById(index: number, hero: Hero): number { return hero.id; } | ||
|  | } | ||
|  | 
 | ||
|  | 
 | ||
|  | /* | ||
|  | Copyright 2016 Google Inc. All Rights Reserved. | ||
|  | Use of this source code is governed by an MIT-style license that | ||
|  | can be found in the LICENSE file at http://angular.io/license | ||
|  | */"><input type="hidden" name="files[app/app.module.ts]" value="import { NgModule }      from '@angular/core'; | ||
|  | import { FormsModule }   from '@angular/forms'; | ||
|  | import { BrowserModule } from '@angular/platform-browser'; | ||
|  | 
 | ||
|  | import { AppComponent }         from './app.component'; | ||
|  | import { heroSwitchComponents } from './hero-switch.components'; | ||
|  | import { UnlessDirective }    from './unless.directive'; | ||
|  | 
 | ||
|  | @NgModule({ | ||
|  |   imports: [ BrowserModule, FormsModule ], | ||
|  |   declarations: [ | ||
|  |     AppComponent, | ||
|  |     heroSwitchComponents, | ||
|  |     UnlessDirective | ||
|  |   ], | ||
|  |   bootstrap: [ AppComponent ] | ||
|  | }) | ||
|  | export class AppModule { } | ||
|  | 
 | ||
|  | 
 | ||
|  | /* | ||
|  | Copyright 2016 Google Inc. All Rights Reserved. | ||
|  | Use of this source code is governed by an MIT-style license that | ||
|  | can be found in the LICENSE file at http://angular.io/license | ||
|  | */"><input type="hidden" name="files[app/hero-switch.components.ts]" value="import { Component, Input } from '@angular/core'; | ||
|  | import { Hero } from './hero'; | ||
|  | 
 | ||
|  | @Component({ | ||
|  |   selector: 'happy-hero', | ||
|  |   template: `Wow. You like {{hero.name}}. What a happy hero ... just like you.` | ||
|  | }) | ||
|  | export class HappyHeroComponent { | ||
|  |   @Input() hero: Hero; | ||
|  | } | ||
|  | 
 | ||
|  | @Component({ | ||
|  |   selector: 'sad-hero', | ||
|  |   template: `You like {{hero.name}}? Such a sad hero. Are you sad too?` | ||
|  | }) | ||
|  | export class SadHeroComponent { | ||
|  |   @Input() hero: Hero; | ||
|  | } | ||
|  | 
 | ||
|  | @Component({ | ||
|  |   selector: 'confused-hero', | ||
|  |   template: `Are you as confused as {{hero.name}}?` | ||
|  | }) | ||
|  | export class ConfusedHeroComponent { | ||
|  |   @Input() hero: Hero; | ||
|  | } | ||
|  | 
 | ||
|  | @Component({ | ||
|  |   selector: 'unknown-hero', | ||
|  |   template: `{{message}}` | ||
|  | }) | ||
|  | export class UnknownHeroComponent { | ||
|  |   @Input() hero: Hero; | ||
|  |   get message() { | ||
|  |     return this.hero && this.hero.name ? | ||
|  |       `${this.hero.name} is strange and mysterious.` : | ||
|  |       'Are you feeling indecisive?'; | ||
|  |   } | ||
|  | } | ||
|  | 
 | ||
|  | export const heroSwitchComponents = | ||
|  |   [ HappyHeroComponent, SadHeroComponent, ConfusedHeroComponent, UnknownHeroComponent ]; | ||
|  | 
 | ||
|  | 
 | ||
|  | /* | ||
|  | Copyright 2016 Google Inc. All Rights Reserved. | ||
|  | Use of this source code is governed by an MIT-style license that | ||
|  | can be found in the LICENSE file at http://angular.io/license | ||
|  | */"><input type="hidden" name="files[app/hero.ts]" value="export class Hero { | ||
|  |   id: number; | ||
|  |   name: string; | ||
|  |   emotion?: string; | ||
|  | } | ||
|  | 
 | ||
|  | export const heroes: Hero[] = [ | ||
|  |   { id: 1, name: 'Mr. Nice',  emotion: 'happy'}, | ||
|  |   { id: 2, name: 'Narco',     emotion: 'sad' }, | ||
|  |   { id: 3, name: 'Windstorm', emotion: 'confused' }, | ||
|  |   { id: 4, name: 'Magneta'} | ||
|  | ]; | ||
|  | 
 | ||
|  | 
 | ||
|  | /* | ||
|  | Copyright 2016 Google Inc. All Rights Reserved. | ||
|  | Use of this source code is governed by an MIT-style license that | ||
|  | can be found in the LICENSE file at http://angular.io/license | ||
|  | */"><input type="hidden" name="files[app/unless.directive.ts]" value="import { Directive, Input, TemplateRef, ViewContainerRef } from '@angular/core'; | ||
|  | 
 | ||
|  | /** | ||
|  |  * Add the template content to the DOM unless the condition is true. | ||
|  |  * | ||
|  |  * If the expression assigned to `myUnless` evaluates to a truthy value | ||
|  |  * then the templated elements are removed removed from the DOM, | ||
|  |  * the templated elements are (re)inserted into the DOM. | ||
|  |  * | ||
|  |  * <div *ngUnless="errorCount" class="success"> | ||
|  |  *   Congrats! Everything is great! | ||
|  |  * </div> | ||
|  |  * | ||
|  |  * ### Syntax | ||
|  |  * * | ||
|  |  * - `<div *myUnless="condition">...</div>` | ||
|  |  * - `<div template="myUnless condition">...</div>` | ||
|  |  * - `<template [myUnless]="condition"><div>...</div></template>` | ||
|  |  * | ||
|  |  */ | ||
|  | @Directive({ selector: '[myUnless]'}) | ||
|  | export class UnlessDirective { | ||
|  |   private hasView = false; | ||
|  | 
 | ||
|  |   constructor( | ||
|  |     private templateRef: TemplateRef<any>, | ||
|  |     private viewContainer: ViewContainerRef) { } | ||
|  | 
 | ||
|  |   @Input() set myUnless(condition: boolean) { | ||
|  |     if (!condition && !this.hasView) { | ||
|  |       this.viewContainer.createEmbeddedView(this.templateRef); | ||
|  |       this.hasView = true; | ||
|  |     } else if (condition && this.hasView) { | ||
|  |       this.viewContainer.clear(); | ||
|  |       this.hasView = false; | ||
|  |     } | ||
|  |   } | ||
|  | } | ||
|  | 
 | ||
|  | 
 | ||
|  | /* | ||
|  | Copyright 2016 Google Inc. All Rights Reserved. | ||
|  | Use of this source code is governed by an MIT-style license that | ||
|  | can be found in the LICENSE file at http://angular.io/license | ||
|  | */"><input type="hidden" name="files[main.ts]" value="import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; | ||
|  | import { AppModule } from './app/app.module'; | ||
|  | 
 | ||
|  | platformBrowserDynamic().bootstrapModule(AppModule); | ||
|  | 
 | ||
|  | 
 | ||
|  | 
 | ||
|  | /* | ||
|  | Copyright 2016 Google Inc. All Rights Reserved. | ||
|  | Use of this source code is governed by an MIT-style license that | ||
|  | can be found in the LICENSE file at http://angular.io/license | ||
|  | */"><input type="hidden" name="files[app/app.component.css]" value="button { | ||
|  |   min-width: 100px; | ||
|  |   font-size: 100%; | ||
|  | } | ||
|  | 
 | ||
|  | .box { | ||
|  |   border: 1px solid gray; | ||
|  |   max-width: 600px; | ||
|  |   padding: 4px; | ||
|  | } | ||
|  | .choices { | ||
|  |   font-style: italic; | ||
|  | } | ||
|  | 
 | ||
|  | code, .code { | ||
|  |   background-color: #eee; | ||
|  |   color: black; | ||
|  |   font-family: Courier, sans-serif; | ||
|  |   font-size: 85%; | ||
|  | } | ||
|  | 
 | ||
|  | div.code { | ||
|  |   width: 400px; | ||
|  | } | ||
|  | 
 | ||
|  | .heroic { | ||
|  |   font-size: 150%; | ||
|  |   font-weight: bold; | ||
|  | } | ||
|  | 
 | ||
|  | hr { | ||
|  |   margin: 40px 0 | ||
|  | } | ||
|  | 
 | ||
|  | .odd { | ||
|  |   background-color:  palegoldenrod; | ||
|  | } | ||
|  | 
 | ||
|  | td, th { | ||
|  |   text-align: left; | ||
|  |   vertical-align: top; | ||
|  | } | ||
|  | 
 | ||
|  | p span { color: red; font-size: 70%; } | ||
|  | 
 | ||
|  | .unless { | ||
|  |   border: 2px solid; | ||
|  |   padding: 6px; | ||
|  | } | ||
|  | 
 | ||
|  | p.unless { | ||
|  |   width: 500px; | ||
|  | } | ||
|  | 
 | ||
|  | button.a, span.a, .unless.a { | ||
|  |   color: red; | ||
|  |   border-color: gold; | ||
|  |   background-color: yellow; | ||
|  |   font-size: 100%; | ||
|  | } | ||
|  | 
 | ||
|  | button.b, span.b, .unless.b { | ||
|  |   color: black; | ||
|  |   border-color: green; | ||
|  |   background-color: lightgreen; | ||
|  |   font-size: 100%; | ||
|  | } | ||
|  | 
 | ||
|  | 
 | ||
|  | /* | ||
|  | Copyright 2016 Google Inc. All Rights Reserved. | ||
|  | Use of this source code is governed by an MIT-style license that | ||
|  | can be found in the LICENSE file at http://angular.io/license | ||
|  | */"><input type="hidden" name="files[styles.css]" value="/* Master Styles */ | ||
|  | h1 { | ||
|  |   color: #369; | ||
|  |   font-family: Arial, Helvetica, sans-serif; | ||
|  |   font-size: 250%; | ||
|  | } | ||
|  | h2, h3 { | ||
|  |   color: #444; | ||
|  |   font-family: Arial, Helvetica, sans-serif; | ||
|  |   font-weight: lighter; | ||
|  | } | ||
|  | body { | ||
|  |   margin: 2em; | ||
|  | } | ||
|  | body, input[text], button { | ||
|  |   color: #888; | ||
|  |   font-family: Cambria, Georgia; | ||
|  | } | ||
|  | a { | ||
|  |   cursor: pointer; | ||
|  |   cursor: hand; | ||
|  | } | ||
|  | button { | ||
|  |   font-family: Arial; | ||
|  |   background-color: #eee; | ||
|  |   border: none; | ||
|  |   padding: 5px 10px; | ||
|  |   border-radius: 4px; | ||
|  |   cursor: pointer; | ||
|  |   cursor: hand; | ||
|  | } | ||
|  | button:hover { | ||
|  |   background-color: #cfd8dc; | ||
|  | } | ||
|  | button:disabled { | ||
|  |   background-color: #eee; | ||
|  |   color: #aaa; | ||
|  |   cursor: auto; | ||
|  | } | ||
|  | 
 | ||
|  | /* Navigation link styles */ | ||
|  | nav a { | ||
|  |   padding: 5px 10px; | ||
|  |   text-decoration: none; | ||
|  |   margin-right: 10px; | ||
|  |   margin-top: 10px; | ||
|  |   display: inline-block; | ||
|  |   background-color: #eee; | ||
|  |   border-radius: 4px; | ||
|  | } | ||
|  | nav a:visited, a:link { | ||
|  |   color: #607D8B; | ||
|  | } | ||
|  | nav a:hover { | ||
|  |   color: #039be5; | ||
|  |   background-color: #CFD8DC; | ||
|  | } | ||
|  | nav a.active { | ||
|  |   color: #039be5; | ||
|  | } | ||
|  | 
 | ||
|  | /* items class */ | ||
|  | .items { | ||
|  |   margin: 0 0 2em 0; | ||
|  |   list-style-type: none; | ||
|  |   padding: 0; | ||
|  |   width: 24em; | ||
|  | } | ||
|  | .items li { | ||
|  |   cursor: pointer; | ||
|  |   position: relative; | ||
|  |   left: 0; | ||
|  |   background-color: #EEE; | ||
|  |   margin: .5em; | ||
|  |   padding: .3em 0; | ||
|  |   height: 1.6em; | ||
|  |   border-radius: 4px; | ||
|  | } | ||
|  | .items li:hover { | ||
|  |   color: #607D8B; | ||
|  |   background-color: #DDD; | ||
|  |   left: .1em; | ||
|  | } | ||
|  | .items li.selected { | ||
|  |   background-color: #CFD8DC; | ||
|  |   color: white; | ||
|  | } | ||
|  | .items li.selected:hover { | ||
|  |   background-color: #BBD8DC; | ||
|  | } | ||
|  | .items .text { | ||
|  |   position: relative; | ||
|  |   top: -3px; | ||
|  | } | ||
|  | .items .badge { | ||
|  |   display: inline-block; | ||
|  |   font-size: small; | ||
|  |   color: white; | ||
|  |   padding: 0.8em 0.7em 0 0.7em; | ||
|  |   background-color: #607D8B; | ||
|  |   line-height: 1em; | ||
|  |   position: relative; | ||
|  |   left: -1px; | ||
|  |   top: -4px; | ||
|  |   height: 1.8em; | ||
|  |   margin-right: .8em; | ||
|  |   border-radius: 4px 0 0 4px; | ||
|  | } | ||
|  | /* everywhere else */ | ||
|  | * { | ||
|  |   font-family: Arial, Helvetica, sans-serif; | ||
|  | } | ||
|  | 
 | ||
|  | 
 | ||
|  | /* | ||
|  | Copyright 2016 Google Inc. All Rights Reserved. | ||
|  | Use of this source code is governed by an MIT-style license that | ||
|  | can be found in the LICENSE file at http://angular.io/license | ||
|  | */"><input type="hidden" name="files[app/app.component.html]" value="<h1>Structural Directives</h1> | ||
|  | 
 | ||
|  | <p>Conditional display of hero</p> | ||
|  | 
 | ||
|  | <blockquote> | ||
|  | <div *ngIf="hero" >{{hero.name}}</div> | ||
|  | </blockquote> | ||
|  | 
 | ||
|  | <p>List of heroes</p> | ||
|  | 
 | ||
|  | <ul> | ||
|  |   <li *ngFor="let hero of heroes">{{hero.name}}</li> | ||
|  | </ul> | ||
|  | 
 | ||
|  | 
 | ||
|  | <hr> | ||
|  | 
 | ||
|  | <h2 id="ngIf">NgIf</h2> | ||
|  | 
 | ||
|  | <p *ngIf="true"> | ||
|  |   Expression is true and ngIf is true. | ||
|  |   This paragraph is in the DOM. | ||
|  | </p> | ||
|  | <p *ngIf="false"> | ||
|  |   Expression is false and ngIf is false. | ||
|  |   This paragraph is not in the DOM. | ||
|  | </p> | ||
|  | 
 | ||
|  | <p [style.display]="'block'"> | ||
|  |   Expression sets display to "block"" . | ||
|  |   This paragraph is visible. | ||
|  | </p> | ||
|  | <p [style.display]="'none'"> | ||
|  |   Expression sets display to "none" . | ||
|  |   This paragraph is hidden but still in the DOM. | ||
|  | </p> | ||
|  | 
 | ||
|  | <h4>NgIf with template</h4> | ||
|  | <p>&lt;template&gt; element</p> | ||
|  | <template [ngIf]="hero"> | ||
|  |   <div>{{hero.name}}</div> | ||
|  | </template> | ||
|  | 
 | ||
|  | <p>template attribute</p> | ||
|  | <div template="ngIf hero">{{hero.name}}</div> | ||
|  | 
 | ||
|  | <hr> | ||
|  | 
 | ||
|  | <h2 id="ng-container">&lt;ng-container&gt;</h2> | ||
|  | 
 | ||
|  | <h4>*ngIf with a &lt;ng-container&gt;</h4> | ||
|  | 
 | ||
|  | <button (click)="hero = hero ? null : heroes[0]">Toggle hero</button> | ||
|  | 
 | ||
|  | <p> | ||
|  |   I turned the corner | ||
|  |   <ng-container *ngIf="hero"> | ||
|  |     and saw {{hero.name}}. I waved | ||
|  |   </ng-container> | ||
|  |   and continued on my way. | ||
|  | </p> | ||
|  | <p> | ||
|  |   I turned the corner | ||
|  |   <span *ngIf="hero"> | ||
|  |     and saw {{hero.name}}. I waved | ||
|  |   </span> | ||
|  |   and continued on my way. | ||
|  | </p> | ||
|  | 
 | ||
|  | <p><i>&lt;select&gt; with &lt;span&gt;</i></p> | ||
|  | <div> | ||
|  |   Pick your favorite hero | ||
|  |   (<label><input type="checkbox" checked (change)="showSad = !showSad">show sad</label>) | ||
|  | </div> | ||
|  | <select [(ngModel)]="hero"> | ||
|  |   <span *ngFor="let h of heroes"> | ||
|  |     <span *ngIf="showSad || h.emotion !== 'sad'"> | ||
|  |       <option [ngValue]="h">{{h.name}} ({{h.emotion}})</option> | ||
|  |     </span> | ||
|  |   </span> | ||
|  | </select> | ||
|  | 
 | ||
|  | <p><i>&lt;select&gt; with &lt;ng-container&gt;</i></p> | ||
|  | <div> | ||
|  |   Pick your favorite hero | ||
|  |   (<label><input type="checkbox" checked (change)="showSad = !showSad">show sad</label>) | ||
|  | </div> | ||
|  | <select [(ngModel)]="hero"> | ||
|  |   <ng-container *ngFor="let h of heroes"> | ||
|  |     <ng-container *ngIf="showSad || h.emotion !== 'sad'"> | ||
|  |       <option [ngValue]="h">{{h.name}} ({{h.emotion}})</option> | ||
|  |     </ng-container> | ||
|  |   </ng-container> | ||
|  | </select> | ||
|  | <br><br> | ||
|  | 
 | ||
|  | <hr> | ||
|  | 
 | ||
|  | <h2 id="ngFor">NgFor</h2> | ||
|  | 
 | ||
|  | <div class="box"> | ||
|  | 
 | ||
|  | <p class="code">&lt;div *ngFor="let hero of heroes; let i=index; let odd=odd; trackBy: trackById" [class.odd]="odd"&gt;</p> | ||
|  | <div *ngFor="let hero of heroes; let i=index; let odd=odd; trackBy: trackById" [class.odd]="odd"> | ||
|  |   ({{i}}) {{hero.name}} | ||
|  | </div> | ||
|  | 
 | ||
|  | <p class="code">&lt;div template="ngFor let hero of heroes; let i=index; let odd=odd; trackBy: trackById" [class.odd]="odd"&gt;</p> | ||
|  | <div template="ngFor let hero of heroes; let i=index; let odd=odd; trackBy: trackById" [class.odd]="odd"> | ||
|  |   ({{i}}) {{hero.name}} | ||
|  | </div> | ||
|  | 
 | ||
|  | <p class="code">&lt;template ngFor let-hero [ngForOf]="heroes" let-i="index" let-odd="odd" [ngForTrackBy]="trackById"&gt;</p> | ||
|  | <template ngFor let-hero [ngForOf]="heroes" let-i="index" let-odd="odd" [ngForTrackBy]="trackById"> | ||
|  |   <div [class.odd]="odd">({{i}}) {{hero.name}}</div> | ||
|  | </template> | ||
|  | 
 | ||
|  | </div> | ||
|  | <hr> | ||
|  | 
 | ||
|  | <h2 id="ngSwitch">NgSwitch</h2> | ||
|  | 
 | ||
|  | <div>Pick your favorite hero</div> | ||
|  | <p> | ||
|  |   <ng-container *ngFor="let h of heroes"> | ||
|  |     <label> | ||
|  |       <input type="radio" name="heroes" [(ngModel)]="hero" [value]="h">{{h.name}} | ||
|  |     </label> | ||
|  |   </ng-container> | ||
|  |   <label><input type="radio" name="heroes" (click)="hero = null">None of the above</label> | ||
|  | </p> | ||
|  | 
 | ||
|  | <h4>NgSwitch</h4> | ||
|  | 
 | ||
|  | <div [ngSwitch]="hero?.emotion"> | ||
|  |   <happy-hero    *ngSwitchCase="'happy'"    [hero]="hero"></happy-hero> | ||
|  |   <sad-hero      *ngSwitchCase="'sad'"      [hero]="hero"></sad-hero> | ||
|  |   <confused-hero *ngSwitchCase="'confused'" [hero]="hero"></confused-hero> | ||
|  |   <unknown-hero  *ngSwitchDefault           [hero]="hero"></unknown-hero> | ||
|  | </div> | ||
|  | 
 | ||
|  | <h4>NgSwitch with <i>template</i> attribute</h4> | ||
|  | <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> | ||
|  | 
 | ||
|  | <h4>NgSwitch with &lt;template&gt;</h4> | ||
|  | <div [ngSwitch]="hero?.emotion"> | ||
|  |   <template [ngSwitchCase]="'happy'"> | ||
|  |     <happy-hero [hero]="hero"></happy-hero> | ||
|  |   </template> | ||
|  |   <template [ngSwitchCase]="'sad'"> | ||
|  |     <sad-hero [hero]="hero"></sad-hero> | ||
|  |   </template> | ||
|  |   <template [ngSwitchCase]="'confused'"> | ||
|  |     <confused-hero [hero]="hero"></confused-hero> | ||
|  |   </template > | ||
|  |   <template ngSwitchDefault> | ||
|  |     <unknown-hero [hero]="hero"></unknown-hero> | ||
|  |   </template> | ||
|  | </div> | ||
|  | 
 | ||
|  | <hr> | ||
|  | 
 | ||
|  | <h2>&lt;template&gt;</h2> | ||
|  | <p>Hip!</p> | ||
|  | <template> | ||
|  |   <p>Hip!</p> | ||
|  | </template> | ||
|  | <p>Hooray!</p> | ||
|  | 
 | ||
|  | <hr> | ||
|  | 
 | ||
|  | <h2 id="myUnless">UnlessDirective</h2> | ||
|  | <p> | ||
|  |   The condition is currently | ||
|  |   <span [ngClass]="{ a: !condition, b: condition, unless: true }">{{condition}}</span>. | ||
|  |   <button | ||
|  |     (click)="condition = !condition" | ||
|  |     [ngClass] = "{ a: condition, b: !condition }" > | ||
|  |     Toggle condition to {{condition ? 'false' : 'true'}} | ||
|  |   </button> | ||
|  | </p> | ||
|  | <p *myUnless="condition" class="unless a"> | ||
|  |   (A) This paragraph is displayed because the condition is false. | ||
|  | </p> | ||
|  | 
 | ||
|  | <p *myUnless="!condition" class="unless b"> | ||
|  |   (B) Although the condition is true, | ||
|  |   this paragraph is displayed because myUnless is set to false. | ||
|  | </p> | ||
|  | 
 | ||
|  | 
 | ||
|  | <h4>UnlessDirective with template</h4> | ||
|  | 
 | ||
|  | <p *myUnless="condition">Show this sentence unless the condition is true.</p> | ||
|  | 
 | ||
|  | <p template="myUnless condition" class="code unless"> | ||
|  |   (A) &lt;p template="myUnless condition" class="code unless"&gt; | ||
|  | </p> | ||
|  | 
 | ||
|  | <template [myUnless]="condition"> | ||
|  |   <p class="code unless"> | ||
|  |     (A) &lt;template [myUnless]="condition"&gt; | ||
|  |   </p> | ||
|  | </template> | ||
|  | 
 | ||
|  | 
 | ||
|  | 
 | ||
|  | <!-- 
 | ||
|  | Copyright 2016 Google Inc. All Rights Reserved. | ||
|  | Use of this source code is governed by an MIT-style license that | ||
|  | can be found in the LICENSE file at http://angular.io/license | ||
|  | -->"><input type="hidden" name="files[index.html]" value="<!DOCTYPE html> | ||
|  | <html> | ||
|  |   <head> | ||
|  |     <title>Angular Structural Directives</title> | ||
|  |     <script>document.write('<base href="' + document.location + '" />');</script> | ||
|  |     <meta charset="UTF-8"> | ||
|  |     <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
|  |     <link rel="stylesheet" href="styles.css"> | ||
|  | 
 | ||
|  |     <!-- Polyfills --> | ||
|  |     <script src="https://unpkg.com/core-js/client/shim.min.js"></script> | ||
|  | 
 | ||
|  |     <script src="https://unpkg.com/zone.js@0.7.4?main=browser"></script> | ||
|  |     <script src="https://unpkg.com/systemjs@0.19.39/dist/system.src.js"></script> | ||
|  | 
 | ||
|  |     <script src="https://cdn.rawgit.com/angular/angular.io/b3c65a9/public/docs/_examples/_boilerplate/systemjs.config.web.js"></script> | ||
|  |     <script> | ||
|  |       System.import('main.js').catch(function(err){ console.error(err); }); | ||
|  |     </script> | ||
|  |   </head> | ||
|  | 
 | ||
|  |   <body> | ||
|  |     <my-app>Loading...</my-apps> | ||
|  |   </body> | ||
|  | 
 | ||
|  | </html> | ||
|  | 
 | ||
|  | 
 | ||
|  | <!-- 
 | ||
|  | Copyright 2016 Google Inc. All Rights Reserved. | ||
|  | Use of this source code is governed by an MIT-style license that | ||
|  | can be found in the LICENSE file at http://angular.io/license | ||
|  | -->"><input type="hidden" name="tags[0]" value="angular"><input type="hidden" name="tags[1]" value="example"><input type="hidden" name="tags[2]" value="structural"><input type="hidden" name="tags[3]" value="directives"><input type="hidden" name="tags[4]" value="template"><input type="hidden" name="tags[5]" value="ngIf"><input type="hidden" name="tags[6]" value="ngSwitch"><input type="hidden" name="tags[7]" value="ngFor"><input type="hidden" name="private" value="true"><input type="hidden" name="description" value="Angular Example - Structural directives"></form><script>document.getElementById("mainForm").submit();</script></body></html> |