You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12-14Lines changed: 12 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -614,17 +614,15 @@ export class AppComponent {
614
614
615
615
## Scope
616
616
617
-
The scope of a variable in Angular refers to the context in which the variable is defined and can be accessed. There are three main types of scope in Angular:
617
+
In Angular, the scope of a variable determines where it can be accessed:
618
618
619
-
- **Global Scope** - Variables defined in the global scope are accessible from anywhere in the application. They are defined outside of any function or block of code.
620
-
621
-
- **Local Scope** - 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.
622
-
623
-
- **Component Scope** - Variables defined in an Angular component are accessible within that component and its child components. They are not accessible outside of the component.
619
+
- **Global Scope**: Accessible anywhere in the application.
620
+
- **Local Scope**: Accessible only within a specific function or block.
621
+
- **Component Scope**: Accessible within a component and its child components.
624
622
625
623
### Global Scope
626
624
627
-
Variables defined in the global scope are accessible from anywhere in the application. They are defined outside of any function or block of code.
625
+
Accessible from anywhere in the application; defined outside any function or block.
628
626
629
627
Example :
630
628
@@ -665,7 +663,7 @@ export class AppComponent {
665
663
666
664
### Local Scope
667
665
668
-
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.
666
+
Accessible only within the function or block where defined.
669
667
670
668
Example :
671
669
@@ -707,7 +705,7 @@ export class AppComponent {
707
705
708
706
### Component Scope
709
707
710
-
Variables defined in an Angular component are accessible within that component and its child components. They are not accessible outside of the component.
708
+
Accessible within the component and its children.
711
709
712
710
Example :
713
711
@@ -735,11 +733,11 @@ export class AppComponent {
735
733
736
734
## View Encapsulation
737
735
738
-
View Encapsulation is a feature of Angular that allows you to control how styles are applied to components. By default, Angular uses Emulated View Encapsulation, which means that styles are scoped to the component and do not affect other components.
736
+
Controls how styles are applied to components. By default, Angular uses Emulated View Encapsulation, scoping styles to the component.
739
737
740
738
### Emulated View Encapsulation
741
739
742
-
Emulated View Encapsulation is the default mode in Angular. In this mode, Angular emulates the shadow DOM to apply styles to components. This means that styles are scoped to the component and do not affect other components.
740
+
Default mode in Angular, emulating shadow DOM to scope styles to the component.
743
741
744
742
```typescript
745
743
import { Component, ViewEncapsulation } from '@angular/core';
@@ -757,7 +755,7 @@ export class AppComponent {
757
755
758
756
### Shadow DOM View Encapsulation
759
757
760
-
Shadow DOM View Encapsulation uses the native shadow DOM to apply styles to components. This means that styles are encapsulated within the shadow DOM and do not affect other components.
758
+
Uses native shadow DOM to encapsulate styles within the component, preventing them from affecting other components.
761
759
762
760
```typescript
763
761
import { Component, ViewEncapsulation } from '@angular/core';
@@ -775,7 +773,7 @@ export class AppComponent {
775
773
776
774
### None View Encapsulation
777
775
778
-
None View Encapsulation disables view encapsulation for the component. This means that styles are not scoped to the component and can affect other components.
776
+
Disables encapsulation; styles can affect other components.
779
777
780
778
```typescript
781
779
import { Component, ViewEncapsulation } from '@angular/core';
@@ -795,7 +793,7 @@ export class AppComponent {
795
793
796
794
## Component Communication
797
795
798
-
Component communication is the process of passing data between components in an Angular application. There are several ways to achieve component communication in Angular, including Input and Output decorators, EventEmitter, and services.
796
+
Passing data between Angular components using Input/Output decorators, EventEmitter, and services.
0 commit comments