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
5
5
## Angular Template
6
6
7
7
``` 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() ) {
10
10
<div >This content is conditionally displayed.</div >
11
11
}
12
12
```
@@ -18,11 +18,11 @@ import { Component } from '@angular/core';
18
18
19
19
@Component ({
20
20
selector: ' app-example' ,
21
- templateUrl: ' ./example.component. html' ,
22
- styleUrls: [ ' ./example.component. css' ] ,
21
+ templateUrl: ' ./example.html' ,
22
+ styleUrl: ' ./example.css' ,
23
23
})
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 ) ;
27
27
}
28
28
```
You can’t perform that action at this time.
0 commit comments