Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions aio/content/examples/ngcontainer/src/app/app.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ button {
font-size: 100%;
}

code, .code {
code,
.code {
background-color: #eee;
color: black;
font-family: Courier, sans-serif;
Expand All @@ -21,14 +22,18 @@ div.code {
}

hr {
margin: 40px 0
margin: 40px 0;
}

td, th {
td,
th {
text-align: left;
vertical-align: top;
}

/* #docregion p-span */
p span { color: red; font-size: 70%; }
p span {
color: red;
font-size: 70%;
}
/* #enddocregion p-span */
4 changes: 2 additions & 2 deletions aio/content/examples/ngcontainer/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ <h4>#1 &lt;ng-container&gt; and &lt;options&gt;</h4>
<!-- #docregion select-span -->
<select [(ngModel)]="hero">
<span *ngFor="let h of heroes">
<span *ngIf="showSad || h?.emotion != 'sad'">
<span *ngIf="showSad || h?.emotion !== 'sad'">
<option [ngValue]="h">{{h.name}} ({{h?.emotion}})</option>
</span>
</span>
Expand All @@ -147,7 +147,7 @@ <h4>#1 &lt;ng-container&gt; and &lt;options&gt;</h4>
<!-- #docregion select-ngcontainer -->
<select [(ngModel)]="hero">
<ng-container *ngFor="let h of heroes">
<ng-container *ngIf="showSad || h?.emotion != 'sad'">
<ng-container *ngIf="showSad || h?.emotion !== 'sad'">
<option [ngValue]="h">{{h.name}} ({{h?.emotion}})</option>
</ng-container>
</ng-container>
Expand Down
5 changes: 3 additions & 2 deletions aio/content/examples/ngcontainer/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ import { heroes } from './hero';
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: [ './app.component.css' ]
styleUrls: ['./app.component.css']
})
export class AppComponent {
heroes = heroes;
hero = this.heroes[0];
heroTraits = [ 'honest', 'brave', 'considerate' ];
heroTraits = ['honest', 'brave', 'considerate'];

// flags for the table

attrDirs = true;
strucDirs = true;
divNgIf = false;
Expand Down
6 changes: 3 additions & 3 deletions aio/content/examples/ngcontainer/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// #docregion
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { BrowserModule } from '@angular/platform-browser';

import { AppComponent } from './app.component';
import { AppComponent } from './app.component';
import { ContentComponent } from './content.component';
import { heroComponents } from './hero.components';

Expand Down
15 changes: 10 additions & 5 deletions aio/content/examples/ngcontainer/src/app/hero.components.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// #docregion
import { Component, Input } from '@angular/core';

import { Hero } from './hero';

@Component({
Expand Down Expand Up @@ -33,11 +34,15 @@ export class ConfusedHeroComponent {
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?';
return this.hero && this.hero.name
? `${this.hero.name} is strange and mysterious.`
: 'Are you feeling indecisive?';
}
}

export const heroComponents =
[ HappyHeroComponent, SadHeroComponent, ConfusedHeroComponent, UnknownHeroComponent ];
export const heroComponents = [
HappyHeroComponent,
SadHeroComponent,
ConfusedHeroComponent,
UnknownHeroComponent
];
6 changes: 3 additions & 3 deletions aio/content/examples/ngcontainer/src/app/hero.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export class Hero {
}

export const heroes: Hero[] = [
{ id: 1, name: 'Mr. Nice', emotion: 'happy'},
{ id: 2, name: 'Narco', emotion: 'sad' },
{ id: 1, name: 'Mr. Nice', emotion: 'happy' },
{ id: 2, name: 'Narco', emotion: 'sad' },
{ id: 3, name: 'Windstorm', emotion: 'confused' },
{ id: 4, name: 'Magneta'}
{ id: 4, name: 'Magneta' }
];