Data Binding Report
Data Binding Report
• 2. Event Binding:
• Purpose: Event binding allows you to respond to user interactions (e.g.,
button clicks, mouse events, keyboard events) by invoking methods in
your component.
• Syntax: Event binding uses parentheses ( ) to bind an event emitted by
an HTML element to a method in your component. For example:
(event)="handler()“.
• Use Cases: Event binding is used for handling user interactions and
executing methods in response to events like clicks, key presses, mouse
movements, and more.
Two way Binding
•
In Angular, you can create custom properties (also known as custom
attributes or inputs) for your components to allow data to flow into the
component from its parent component or template. These custom properties
enable you to pass values, configurations, or objects into your components,
making them highly flexible and reusable.
What is Encapsulation
@Component({
selector: 'app-example',
template: '<p>{{ message }}</p>',
})
export class ExampleComponent {
@Input() message: string;
}
• Services: In Angular, services are used for sharing data and logic
between components. Services are typically singleton instances
that can be injected into components. They can be used for tasks
like making HTTP requests, managing application state, and
sharing data between components.
• Routing: Angular provides a router module that allows you to
build Single Page Applications (SPAs) with multiple views and
navigation between them. You can define routes and associate
components with specific routes.
• Observables: Angular leverages RxJS observables to handle
asynchronous operations and manage data streams. Observables
are used for handling events, asynchronous data, and
communication between components.