Angular - SignalsWhich of the following is the correct way to create a signal in Angular?Aconst count = new Observable(0);Bconst count = signal(0);Cconst count = subscribe(0);Dconst count = createObservable(0);Check Answer
Step-by-Step SolutionSolution:Step 1: Recall Angular signal creation syntaxSignals are created using the signal() function with an initial value.Step 2: Identify incorrect optionsObservable creation uses new Observable(), subscribe is a method, and createObservable() is not valid.Final Answer:const count = signal(0); -> Option BQuick Check:signal() creates signals [OK]Quick Trick: Use signal() function to create signals [OK]Common Mistakes:Using new Observable() to create a signalConfusing subscribe() with signal creationUsing non-existent createObservable() function
Master "Signals" in Angular9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallPerf
More Angular Quizzes Advanced Patterns - Custom structural directives - Quiz 7medium Advanced Patterns - Custom structural directives - Quiz 9hard Performance Optimization - Lazy loading routes and modules - Quiz 14medium Performance Optimization - TrackBy in ngFor - Quiz 11easy Performance Optimization - Tree shaking and dead code removal - Quiz 6medium Performance Optimization - TrackBy in ngFor - Quiz 13medium Standalone Components - Standalone pipes and directives - Quiz 2easy State Management - Service-based state management - Quiz 13medium Testing - Testing with fixtures and debug elements - Quiz 4medium Testing - Mocking services in tests - Quiz 8hard