docs(core): Fix incorrectly rendered code example in structural directives guide (#38207)

The code example was missing a close brace and also incorrectly rendered
the template div as an actual div in the page DOM.

PR Close #38207
This commit is contained in:
Andrew Scott 2020-07-23 16:30:31 -07:00 committed by Misko Hevery
parent 307db74e93
commit cce5583e75
1 changed files with 3 additions and 1 deletions

View File

@ -879,12 +879,14 @@ export type LoadingState<T> = Loaded<T> | Loading;
export class IfLoadedDirective<T> {
@Input('ifLoaded') set state(state: LoadingState<T>) {}
static ngTemplateGuard_state<T>(dir: IfLoadedDirective<T>, expr: LoadingState<T>): expr is Loaded<T> { return true; };
}
export interface Person {
name: string;
}
@Component({
template: `<div *ifLoaded="state">{{ state.data }}</div>`,
template: `&lt;div *ifLoaded="state">{{ state.data }}&lt;/div>`,
})
export class AppComponent {
state: LoadingState<Person>;