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:

committed by
Michael Prentice

parent
c980caecac
commit
da0129b83e
@ -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
|
||||
|
Reference in New Issue
Block a user