Angular TutorialLesson 20Free preview
Angular Conditional
This lesson is part of Angular · All levels
Summary
Conditional rendering only displays elements if certain conditions are met. Angular provides the syntax of modern @if along with @else and @else if, as well as the old *ngIf directive that is still supported. With this structure, you can dynamically control the page view based on data.
Key points
- @if displays blocks when the condition is true
- @else if and @else complete the condition branch
- ngIf still works and is often found on old code
- Use track and structure ng-templates for special cases
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.