Skip to content

Commit d74bc2f

Browse files
committed
chore: Update README.md with improved description of Angular framework
1 parent 76a8acf commit d74bc2f

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

README.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,26 @@ declarations: [
429429
]
430430
```
431431

432-
**Step 11** - Use the component selector in the HTML template of the `app.component.ts` file.
432+
If you created a standalone component, `app.module.ts` file is not required. You can import the component in the `app.component.ts` file.
433+
as shown below.
434+
435+
```typescript
436+
import { [ComponentName]Component } from './[component-name]/[component-name].component';
437+
438+
@Component({
439+
selector: 'app-root',
440+
standalone: true,
441+
imports: [[ComponentName]Component],
442+
templateUrl: './app.component.html',
443+
styleUrl: './app.component.scss'
444+
})
445+
446+
export class AppComponent {
447+
title = 'app';
448+
}
449+
```
450+
451+
**Step 11** - Use the component selector in the HTML template.
433452

434453
```typescript
435454
<app-[component-name]></app-[component-name]>
@@ -487,9 +506,7 @@ import { Component } from '@angular/core';
487506
styleUrls: ['./test-component.component.css']
488507
})
489508

490-
export class TestComponent {
491-
492-
}
509+
export class TestComponent {}
493510
```
494511

495512
You can create a standalone component by setting the `standalone` property to `true`. The standalone component is enabled by default in Angular v17 and later. You can disable the standalone component by setting the `standalone` property to `false` in the `@Component` decorator of the component. If you disable the standalone component, you need to import the component in the `app.module.ts` file. If you created a non-standalone component, you will see no standalone property in the `@Component` decorator.

0 commit comments

Comments
 (0)