This repository was archived by the owner on Dec 4, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 875
docs(template-syntax): code fixes and copyedits #3365
Merged
wardbell
merged 1 commit into
angular:master
from
IdeaBlade:chalin-template-syntax-copyedits-0306
Mar 9, 2017
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,8 +31,8 @@ export class AppComponent implements AfterViewInit, OnInit { | |
|
||
ngAfterViewInit() { | ||
// Detect effects of NgForTrackBy | ||
trackChanges(this.heroesNoTrackBy, () => this.heroesNoTrackByCount += 1); | ||
trackChanges(this.heroesWithTrackBy, () => this.heroesWithTrackByCount += 1); | ||
trackChanges(this.heroesNoTrackBy, () => this.heroesNoTrackByCount++); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Crockford will be very unhappy with you. He disapproves of At the time I wrote this, I'm not sure that All FYI. No need to revert. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. :) k |
||
trackChanges(this.heroesWithTrackBy, () => this.heroesWithTrackByCount++); | ||
} | ||
|
||
@ViewChildren('noTrackBy') heroesNoTrackBy: QueryList<ElementRef>; | ||
|
@@ -42,6 +42,7 @@ export class AppComponent implements AfterViewInit, OnInit { | |
alert = alerter; | ||
badCurly = 'bad curly'; | ||
classes = 'special'; | ||
help = ''; | ||
|
||
callFax(value: string) {this.alert(`Faxing ${value} ...`); } | ||
callPhone(value: string) {this.alert(`Calling ${value} ...`); } | ||
|
@@ -83,17 +84,9 @@ export class AppComponent implements AfterViewInit, OnInit { | |
|
||
title = 'Template Syntax'; | ||
|
||
getStyles(el: Element) { | ||
let styles = window.getComputedStyle(el); | ||
let showStyles = {}; | ||
for (let p in this.currentStyles) { // only interested in these styles | ||
showStyles[p] = styles[p]; | ||
} | ||
return JSON.stringify(showStyles); | ||
} | ||
|
||
getVal() { return this.val; } | ||
getVal(): number { return 2; } | ||
|
||
name: string = Hero.heroes[0].name; | ||
hero: Hero; // defined to demonstrate template context precedence | ||
heroes: Hero[]; | ||
|
||
|
@@ -107,18 +100,16 @@ export class AppComponent implements AfterViewInit, OnInit { | |
// heroImageUrl = 'http://www.wpclipart.com/cartoon/people/hero/hero_silhoutte_T.png'; | ||
// Public Domain terms of use: http://www.wpclipart.com/terms.html | ||
heroImageUrl = 'images/hero.png'; | ||
// villainImageUrl = 'http://www.clker.com/cliparts/u/s/y/L/x/9/villain-man-hi.png' | ||
// Public Domain terms of use http://www.clker.com/disclaimer.html | ||
villainImageUrl = 'images/villain.png'; | ||
|
||
iconUrl = 'images/ng-logo.png'; | ||
isActive = false; | ||
isSpecial = true; | ||
isUnchanged = true; | ||
|
||
nullHero: Hero = null; | ||
|
||
onCancel(event: KeyboardEvent) { | ||
let evtMsg = event ? ' Event target is ' + (<HTMLElement>event.target).innerHTML : ''; | ||
this.alert('Canceled.' + evtMsg); | ||
} | ||
get nullHero(): Hero { return null; } | ||
|
||
onClickMe(event: KeyboardEvent) { | ||
let evtMsg = event ? ' Event target class is ' + (<HTMLElement>event.target).className : ''; | ||
|
@@ -128,9 +119,10 @@ export class AppComponent implements AfterViewInit, OnInit { | |
onSave(event: KeyboardEvent) { | ||
let evtMsg = event ? ' Event target is ' + (<HTMLElement>event.target).innerText : ''; | ||
this.alert('Saved.' + evtMsg); | ||
if (event) { event.stopPropagation(); } | ||
} | ||
|
||
onSubmit() { /* referenced but not used */} | ||
onSubmit() {/* referenced but not used */} | ||
|
||
product = { | ||
name: 'frimfram', | ||
|
@@ -144,17 +136,6 @@ export class AppComponent implements AfterViewInit, OnInit { | |
this.heroesWithTrackByCountReset = 0; | ||
} | ||
|
||
private samenessCount = 5; | ||
moreOfTheSame() { this.samenessCount++; }; | ||
get sameAsItEverWas() { | ||
let result: string[] = Array(this.samenessCount); | ||
for ( let i = result.length; i-- > 0; ) { result[i] = 'same as it ever was ...'; } | ||
return result; | ||
// return [1,2,3,4,5].map(id => { | ||
// return {id:id, text: 'same as it ever was ...'}; | ||
// }); | ||
} | ||
|
||
setUppercaseName(name: string) { | ||
this.currentHero.name = name.toUpperCase(); | ||
} | ||
|
@@ -174,8 +155,8 @@ export class AppComponent implements AfterViewInit, OnInit { | |
// #docregion setStyles | ||
currentStyles: {}; | ||
setCurrentStyles() { | ||
// CSS styles: set per current state of component properties | ||
this.currentStyles = { | ||
// CSS styles: set per current state of component properties | ||
'font-style': this.canSave ? 'italic' : 'normal', | ||
'font-weight': !this.isUnchanged ? 'bold' : 'normal', | ||
'font-size': this.isSpecial ? '24px' : '12px' | ||
|
@@ -190,11 +171,6 @@ export class AppComponent implements AfterViewInit, OnInit { | |
// #docregion trackById | ||
trackById(index: number, item: any): number { return item['id']; } | ||
// #enddocregion trackById | ||
|
||
val = 2; | ||
// villainImageUrl = 'http://www.clker.com/cliparts/u/s/y/L/x/9/villain-man-hi.png' | ||
// Public Domain terms of use http://www.clker.com/disclaimer.html | ||
villainImageUrl = 'images/villain.png'; | ||
} | ||
|
||
// helper to track changes to viewChildren | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am fine with this as long as the text is not about
<ng-container>
. Can you confirm that it is not (I don't have time to look right now).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not. Like for the structural directives page, this is just support code -- i.e., it is not featured on the page.