Angular Fundamentals
Components, templates, data binding, structural directives, ngFor, ngIf, interpolation, property binding, event binding
1What is a component in Angular?
What is a component in Angular?
Answer
A component is a fundamental building block of an Angular application that controls a portion of the user interface. It combines an HTML template, CSS styles, and a TypeScript class with the @Component decorator. This architecture enables creating reusable and modular interfaces, promoting separation of concerns between the view and business logic.
2Which syntax displays a TypeScript variable in the template?
Which syntax displays a TypeScript variable in the template?
Answer
Interpolation with double curly braces {{ variable }} inserts dynamic values into the HTML template. Angular evaluates the TypeScript expression and converts the result to a string displayed in the DOM. This syntax is used to display component properties, perform simple calculations, or call methods that return values.
3How to bind an HTML property to a component variable?
How to bind an HTML property to a component variable?
Answer
Property binding with brackets [property]="variable" binds a DOM element property to a TypeScript expression. Angular evaluates the expression and updates the property automatically when changes occur. This syntax is one-way (component to template) and applies to standard HTML attributes, custom properties, or child component inputs.
Which syntax captures a user event in the template?
What does the *ngIf directive do in an Angular template?
+17 interview questions
Other Angular interview topics
TypeScript Basics
TypeScript Advanced
Components & Lifecycle
Services & Dependency Injection
Angular Modules Organization
Angular CLI
Directives & Pipes
Routing & Navigation
Reactive Forms
Template-driven Forms
RxJS Fundamentals
RxJS Operators
HttpClient & API Calls
Basic State Management
Change Detection
Angular Signals
Standalone Components
Angular Unit Testing
End-to-End Testing
Build & Optimization
NgRx Fundamentals
NgRx Advanced
Angular Architecture
Performance Optimization
Security & Best Practices
Advanced RxJS Patterns
Angular Universal & SSR
Angular Micro-frontends
Master Angular for your next interview
Access all questions, flashcards, technical tests, code review exercises and interview simulators.
Start for free