Skip to content

Commit e213b63

Browse files
committed
chore: Update GitHub Actions workflow to include version-file in releases.yml
1 parent 0072962 commit e213b63

File tree

1 file changed

+165
-6
lines changed

1 file changed

+165
-6
lines changed

README.md

Lines changed: 165 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ This repository contains a list of resources to learn Angular. It includes tutor
167167

168168
## Introduction
169169

170-
Angular is a popular open-source web application framework developed by Google. It is used for building single-page web applications and dynamic web applications. Angular provides a set of tools and libraries for building modern web applications, including components, services, forms, routing, HTTP client, and more. Angular is built using TypeScript, a superset of JavaScript that adds static typing and other features to the language. Angular is known for its performance, scalability, and developer productivity.
170+
**Angular** is a popular open-source web application framework developed by Google. It is used for building single-page web applications and dynamic web applications. Angular provides a set of tools and libraries for building modern web applications, including components, services, forms, routing, HTTP client, and more. Angular is built using TypeScript, a superset of JavaScript that adds static typing and other features to the language. Angular is known for its performance, scalability, and developer productivity.
171171

172172
### Features of Angular
173173

@@ -225,7 +225,7 @@ Angular is a popular open-source web application framework developed by Google.
225225

226226
## SPA
227227

228-
SPA stands for Single Page Application. It is a web application or website that interacts with the user by dynamically rewriting the current page rather than loading entire new pages from the server. This approach allows for a more fluid and responsive user experience, as the page does not need to be reloaded each time the user interacts with it.
228+
**SPA** stands for **Single Page Application**. It is a web application or website that interacts with the user by dynamically rewriting the current page rather than loading entire new pages from the server. This approach allows for a more fluid and responsive user experience, as the page does not need to be reloaded each time the user interacts with it.
229229

230230
### Advantages of SPA
231231

@@ -254,6 +254,8 @@ SPA stands for Single Page Application. It is a web application or website that
254254
### Prerequisites
255255

256256
- Node.js
257+
- NPM
258+
- Angular CLI
257259

258260
### Installation
259261

@@ -263,13 +265,19 @@ Install the Angular CLI globally:
263265
npm install -g @angular/cli
264266
```
265267

268+
If you have already installed the Angular CLI, you can update it to the latest version using the following command:
269+
270+
```bash
271+
npm install -g @angular/cli@latest
272+
```
273+
266274
Check version
267275

268276
```bash
269277
ng version
270278
```
271279

272-
Create workspace:
280+
Create a new Angular project: (Replace `[PROJECT NAME]` with your project name)
273281

274282
```bash
275283
# with standalone component
@@ -279,7 +287,7 @@ ng new [PROJECT NAME]
279287
ng new [PROJECT NAME] --standalone=false
280288
```
281289

282-
Note: In version v17 and later, the standalone component is default enabled. In version v16 and earlier, the standalone component is disabled by default. You can enable or disable the standalone component using the `--standalone` flag.
290+
**Note**: In version v17 and later, the standalone component is default enabled. In version v16 and earlier, the standalone component is disabled by default. You can enable or disable the standalone component using the `--standalone` flag. (In this repository, an example repository is created with the latest version of Angular.)
283291

284292
Navigate to the project directory:
285293

@@ -383,11 +391,14 @@ import { Component } from '@angular/core';
383391
```typescript
384392
@Component({
385393
selector: 'app-[component-name]',
394+
standalone: true,
386395
templateUrl: './[component-name].component.html',
387396
styleUrls: ['./[component-name].component.css']
388397
})
389398
```
390399

400+
If you want to create a standalone component, set the `standalone` property to `true`. If you want to create a non-standalone component, set the `standalone` property to `false`. The standalone component is enabled by default in Angular v17 and later.
401+
391402
**Step 7** - Define the selector, template, and styles for the component.
392403

393404
```text
@@ -432,7 +443,9 @@ ng serve
432443

433444
### Example
434445

435-
**Creating the component files** -
446+
**Creating the component files (Version 16 and earlier)** -
447+
448+
```bash
436449

437450
```typescript
438451
//test-component.component.ts
@@ -461,7 +474,39 @@ h1 {
461474
}
462475
```
463476

464-
**Importing the component in the app.module.ts file** -
477+
**Creating the component files (Version 17 and later)** -
478+
479+
```bash
480+
//test-component.component.ts
481+
import { Component } from '@angular/core';
482+
483+
@Component({
484+
selector: 'app-test-component',
485+
standalone: true,
486+
templateUrl: './test-component.component.html',
487+
styleUrls: ['./test-component.component.css']
488+
})
489+
490+
export class TestComponent {
491+
492+
}
493+
```
494+
495+
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.
496+
497+
```html
498+
<!--test-component.component.html-->
499+
<h1>Test Component</h1>
500+
```
501+
502+
```css
503+
/*test-component.component.css*/
504+
h1 {
505+
color: red;
506+
}
507+
```
508+
509+
**Importing the component in the app.module.ts file (Version 16 and earlier)** -
465510

466511
```typescript
467512
//app.module.ts
@@ -485,6 +530,71 @@ import { TestComponent } from './app.component';
485530
export class AppModule { }
486531
```
487532

533+
**Importing the component in the app.module.ts file (Version 17 and later without standalone component)** -
534+
535+
```typescript
536+
//app.module.ts
537+
import { BrowserModule } from '@angular/platform-browser';
538+
import { NgModule } from '@angular/core';
539+
540+
import { AppComponent } from './app.component';
541+
import { TestComponent } from './test-component/test-component.component';
542+
543+
@NgModule({
544+
declarations: [
545+
AppComponent,
546+
TestComponent
547+
],
548+
imports: [
549+
BrowserModule
550+
],
551+
providers: [],
552+
bootstrap: [AppComponent]
553+
})
554+
export class AppModule { }
555+
```
556+
557+
In version 17 and later, the standalone component is enabled by default. You can disable the standalone component by setting the `standalone` property to `false`. Inside app folder, `app.config.ts` file is created by default.
558+
559+
```typescript
560+
import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';
561+
import { provideRouter } from '@angular/router';
562+
563+
import { routes } from './app.routes';
564+
565+
export const appConfig: ApplicationConfig = {
566+
providers: [
567+
provideZoneChangeDetection({ eventCoalescing: true }),
568+
provideRouter(routes),
569+
],
570+
};
571+
```
572+
573+
You can import the component in the `app.component.ts` file and use the component selector in the HTML template.
574+
575+
```typescript
576+
//app.component.ts
577+
import { Component } from '@angular/core';
578+
import { RouterOutlet } from '@angular/router';
579+
import { TestComponent } from './test-component/test-component.component';
580+
581+
@Component({
582+
selector: 'app-root',
583+
standalone: true,
584+
imports: [TestComponent],
585+
templateUrl: './app.component.html',
586+
styleUrl: './app.component.scss'
587+
})
588+
export class AppComponent {
589+
title = 'app';
590+
}
591+
```
592+
593+
```html
594+
<!--app.component.html-->
595+
<app-test-component></app-test-component>
596+
```
597+
488598
**Creating the inline Template & StyleUrls** -
489599

490600
```typescript
@@ -529,6 +639,30 @@ function testFunction() {
529639
testFunction();
530640
```
531641

642+
Example in Angular :
643+
644+
```typescript
645+
import { Component } from '@angular/core';
646+
647+
// Global Scope
648+
let globalVariable = 'Global Variable';
649+
650+
@Component({
651+
selector: 'app-root',
652+
templateUrl: './app.component.html',
653+
styleUrls: ['./app.component.css']
654+
})
655+
656+
export class AppComponent {
657+
title = globalVariable;
658+
}
659+
```
660+
661+
```html
662+
<!--app.component.html-->
663+
<h1>{{ title }}</h1>
664+
```
665+
532666
### Local Scope
533667

534668
Variables defined in a function or block of code are accessible only within that function or block. They are not accessible outside of the function or block.
@@ -546,6 +680,31 @@ testFunction();
546680
console.log(localVariable); // Error: localVariable is not defined
547681
```
548682

683+
Example in Angular :
684+
685+
```typescript
686+
import { Component } from '@angular/core';
687+
688+
@Component({
689+
selector: 'app-root',
690+
templateUrl: './app.component.html',
691+
styleUrls: ['./app.component.css']
692+
})
693+
694+
export class AppComponent {
695+
testFunction() {
696+
// Local Scope
697+
let localVariable = 'Local Variable';
698+
console.log(localVariable); // Output: Local Variable
699+
}
700+
}
701+
```
702+
703+
```html
704+
<!--app.component.html-->
705+
<button (click)="testFunction()">Test Function</button>
706+
```
707+
549708
### Component Scope
550709

551710
Variables defined in an Angular component are accessible within that component and its child components. They are not accessible outside of the component.

0 commit comments

Comments
 (0)