Angular Service: State Management

communication is all about sharing and we can use services to share entity data across components. entity data can be for example posts, products, songs, movies and so on. this kind of service is a data access service.

We use the service as a data access service to encapsulate the common operations with data like get, add, update and delete data items. in the service we create methods that usually will make HTTP requests to get, add, update and delete data. each component that needs the data will use the service to get the data and will make an action on the data through the use of the service.

Continue reading “Angular Service: State Management”

Local References in Angular

Local references are a nice feature for communication between components and the templates. They can be placed on any HTML element by typing a hashtag with a name of your choice on the HTML element. 

The local reference will hold a reference to the whole HTML element with all its properties and you can use them directly only on the template.

Continue reading “Local References in Angular”

View Encapsulation in Angular

Angular by default makes sure that the style that we write in a component will be applied only to the elements of the component. angular enforces this style encapsulation by giving the same attribute to all elements in a component. angular does this for each component by adding a different unique attribute name for each component.

Continue reading “View Encapsulation in Angular”

Communication Between Child/Parent Components in Angular

Angular is based on components and components have to communicate with each other. when we nesting components, we create a parent – child relationship and the most basic communication between parent and child components are property binding and event binding. with the property and event binding we can send data into the component and receive data from the component.

Continue reading “Communication Between Child/Parent Components in Angular”