0
0
Angularframework~5 mins

Standalone pipes and directives in Angular - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does it mean for a pipe or directive to be 'standalone' in Angular?
A standalone pipe or directive in Angular can be used independently without needing to be declared inside an NgModule. It simplifies reuse and reduces boilerplate.
Click to reveal answer
beginner
How do you declare a standalone directive in Angular?
You add the property standalone: true in the directive's decorator, like @Directive({ standalone: true, selector: '[appExample]' }).
Click to reveal answer
intermediate
Can standalone pipes and directives be imported into components directly?
Yes, standalone pipes and directives can be imported directly into a component's imports array, avoiding the need for NgModule imports.
Click to reveal answer
intermediate
What is one benefit of using standalone pipes and directives in Angular projects?
They reduce the complexity of module management, making components more self-contained and easier to maintain or share.
Click to reveal answer
advanced
How does Angular 16+ support standalone pipes and directives?
Angular 16+ fully supports standalone pipes and directives, allowing developers to build applications without NgModules by using the new standalone: true flag.
Click to reveal answer
What property must you add to a directive to make it standalone?
Aexport: true
Bmodule: standalone
Cindependent: yes
Dstandalone: true
Can standalone pipes be used without importing an NgModule?
AOnly if declared in the root module
BYes, they can be imported directly into components
CNo, they always require an NgModule
DOnly in Angular versions before 17
Which Angular version introduced full support for standalone pipes and directives?
AAngular 16+
BAngular 12
CAngular 9
DAngular 15
What is a key advantage of standalone directives?
AThey reduce the need for NgModules
BThey require more boilerplate code
CThey cannot be reused
DThey only work in templates
How do you use a standalone pipe in a component?
AUse it without any import
BDeclare it in the NgModule only
CImport it in the component's imports array
DRegister it in the main.ts file
Explain what standalone pipes and directives are and how they change Angular development.
Think about how Angular used to require NgModules for these.
You got /4 concepts.
    Describe the steps to create and use a standalone directive in an Angular component.
    Focus on declaration, import, and usage.
    You got /3 concepts.