style(docs-infra): fix docs examples for tslint rules related to whitespace (#38143)

This commit updates the docs examples to be compatible with the `align`,
`space-before-function-paren` and `typedef-whitespace` tslint rules.

This is in preparation of updating the docs examples `tslint.json` to
match the one generated for new Angular CLI apps in a future commit.

PR Close #38143
This commit is contained in:
George Kalpakas
2020-07-30 13:03:10 +03:00
committed by Michael Prentice
parent c980caecac
commit da0129b83e
31 changed files with 147 additions and 142 deletions

View File

@ -37,12 +37,12 @@ export class AfterViewComponent implements AfterViewChecked, AfterViewInit {
// Query for a VIEW child of type `ChildViewComponent`
@ViewChild(ChildViewComponent) viewChild: ChildViewComponent;
// #enddocregion hooks
// #enddocregion hooks
constructor(private logger: LoggerService) {
this.logIt('AfterView constructor');
}
// #docregion hooks
// #docregion hooks
ngAfterViewInit() {
// viewChild is set after the view has been initialized
this.logIt('AfterViewInit');
@ -59,11 +59,11 @@ export class AfterViewComponent implements AfterViewChecked, AfterViewInit {
this.doSomething();
}
}
// #enddocregion hooks
// #enddocregion hooks
comment = '';
// #docregion do-something
// #docregion do-something
// This surrogate for real business logic sets the `comment`
private doSomething() {
let c = this.viewChild.hero.length > 10 ? `That's a long name` : '';
@ -72,14 +72,14 @@ export class AfterViewComponent implements AfterViewChecked, AfterViewInit {
this.logger.tick_then(() => this.comment = c);
}
}
// #enddocregion do-something
// #enddocregion do-something
private logIt(method: string) {
let child = this.viewChild;
let message = `${method}: ${child ? child.hero : 'no'} child view`;
this.logger.log(message);
}
// #docregion hooks
// #docregion hooks
// ...
}
// #enddocregion hooks