Skip to content

Commit b256b33

Browse files
cexbrayatalan-agius4
authored andcommitted
refactor(@angular/cli): update mcp if example to use signals
Also updates the component to use the 2025 style guide naming and recommendations in the component
1 parent c0b74cb commit b256b33

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

packages/angular/cli/lib/examples/if-block.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff 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
```

0 commit comments

Comments
 (0)