Angular - FundamentalsYou want to create a reusable Angular component that shows a user's name and age. Which approach correctly passes data to the component?AUse global variables to share name and ageBDeclare name and age as local variables inside the component onlyCUse @Input properties to receive name and age from parentDHardcode name and age inside the component templateCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand data flow in AngularAngular uses @Input properties to pass data from parent to child components, enabling reuse.Step 2: Evaluate other optionsLocal variables don't receive external data, global variables break encapsulation, hardcoding is inflexible.Final Answer:Use @Input properties to receive name and age from parent -> Option CQuick Check:Data passing uses @Input decorator [OK]Quick Trick: Use @Input to pass data into components [OK]Common Mistakes:Using global variablesHardcoding data inside component
Master "Fundamentals" in Angular9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallPerf
More Angular Quizzes Angular Fundamentals - How Angular bootstraps an application - Quiz 8hard Angular Fundamentals - Running and serving an Angular app - Quiz 6medium Angular Fundamentals - Angular project structure walkthrough - Quiz 2easy Angular Modules - NgModule decorator and metadata - Quiz 11easy Component Interaction - ng-content for slot-based composition - Quiz 12easy Components - Inline vs external styles - Quiz 6medium Pipes - Built-in pipes (date, currency, uppercase) - Quiz 15hard Templates and Data Binding - Two-way binding with ngModel - Quiz 1easy Templates and Data Binding - Why data binding matters - Quiz 15hard TypeScript in Angular - Enums in Angular applications - Quiz 5medium