File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
packages/angular/cli/lib/examples Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -5,8 +5,8 @@ This example demonstrates how to use the `@if` control flow block in an Angular
55## Angular Template
66
77``` html
8- <!-- The @if directive will only render this div if the 'isVisible' field in the component is true. -->
9- @if (isVisible) {
8+ <!-- The @if directive will only render this div if the 'isVisible' signal in the component is true. -->
9+ @if (isVisible() ) {
1010<div >This content is conditionally displayed.</div >
1111}
1212```
@@ -18,11 +18,11 @@ import { Component } from '@angular/core';
1818
1919@Component ({
2020 selector: ' app-example' ,
21- templateUrl: ' ./example.component. html' ,
22- styleUrls: [ ' ./example.component. css' ] ,
21+ templateUrl: ' ./example.html' ,
22+ styleUrl: ' ./example.css' ,
2323})
24- export class ExampleComponent {
25- // This boolean field controls the visibility of the element in the template.
26- isVisible : boolean = true ;
24+ export class Example {
25+ // This boolean signal controls the visibility of the element in the template.
26+ protected readonly isVisible = signal ( true ) ;
2727}
2828```
You can’t perform that action at this time.
0 commit comments