Angular Quality & Compliance Flashcards
7 cards from real Angular Web Framework practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 7 Angular Quality & Compliance flashcards as text
What Angular CLI flag enforces strict template type checking during compilation?
Answer: --strict
The `--strict` flag (or `strict: true` in `tsconfig.json`) enables strict template type checking among other TypeScript strict settings.
Which tool does Angular use internally to enforce coding style and detect anti-patterns via static analysis?
Answer: ESLint with @angular-eslint rules
Angular projects use ESLint extended with `@angular-eslint` rules to enforce Angular-specific coding conventions and detect anti-patterns.
When writing an Angular component test, what does `TestBed.createComponent(MyComponent)` return?
Answer: A ComponentFixture wrapping the component
`createComponent()` returns a `ComponentFixture` that provides access to the component instance, the native element, and change detection utilities.
What is the role of `fakeAsync` and `tick()` in Angular unit tests?
Answer: They replace Zone.js with a synchronous scheduler for testing async code
`fakeAsync` creates a controlled synchronous zone where `tick()` advances the virtual clock, making asynchronous operations like timers and promises testable synchronously.
Which Angular security context prevents Cross-Site Scripting when binding dynamic HTML content?
Answer: Angular's built-in sanitization on [innerHTML] bindings
Angular automatically sanitizes values bound to `[innerHTML]` to strip dangerous HTML, preventing XSS without additional developer effort in most cases.
What is the purpose of `ng lint --fix` in an Angular project?
Answer: Applies auto-fixable ESLint rule corrections to source files
`ng lint --fix` passes the `--fix` flag to ESLint, which automatically corrects rule violations that have safe automated fixes.
In Angular testing, what is the difference between `async` (from `@angular/core/testing`) and native `async/await`?
Answer: Angular's `async` wraps the test in a zone that tracks all asynchronous operations before completing
Angular's `waitForAsync` (formerly `async`) runs the test inside an Angular zone that waits for all pending async tasks (Promises, XHR, timers) to complete before finishing.