Angular Elements are packaged as custom elements, a web standard for defining new HTML elements in a _____.

  • Directive
  • Module
  • Service
  • Shadow DOM
Angular Elements are packaged as custom elements, utilizing the web standard for defining new HTML elements in the Shadow DOM.

How can you make a route parameter optional in Angular?

  • Add a "?" to the parameter
  • Use a default value
  • Use a wildcard route
  • Use a regex pattern
You can make a route parameter optional in Angular by adding a "?" to the parameter name in the route configuration. This indicates that the parameter is optional, and the route can still be matched without it.

Which operator can be used to automatically unsubscribe from an observable when a component is destroyed?

  • "map" operator
  • "subscribe" operator
  • "takeUntil" operator
  • "tap" operator
The "takeUntil" operator is commonly used to automatically unsubscribe from an observable when a component is destroyed. It takes an observable that emits when the component is destroyed, ensuring that the original observable is unsubscribed.

A directive that changes the appearance or behavior of a DOM element is known as a(n) _____ directive.

  • attribute
  • component
  • decorator
  • structural
A directive that changes the appearance or behavior of a DOM element is known as an attribute directive in Angular.

In a directive, the ________ decorator is used to get a reference to the host element.

  • @Directive
  • @HostBinding
  • @HostListener
  • @Injectable
In a directive, the @HostBinding decorator is used to get a reference to the host element, allowing you to access and modify its properties.

Reactive forms in Angular are also known as _____ forms.

  • Data-driven forms
  • Dynamic forms
  • Model-driven forms
  • Template forms
Reactive forms in Angular are also known as Model-driven forms, as they focus on creating the model and then binding it to the UI elements.

The [style.color] syntax in an Angular template is an example of _____ binding.

  • Event
  • Interpolation
  • Property
  • Two-way
The [style.color] syntax is an example of Property binding in Angular. It binds an element property (style.color) to a component property.

Angular provides the _____ function to define a sequence of animation steps.

  • animate()
  • bootstrap()
  • ngIf
  • subscribe()
Angular provides the animate() function to define a sequence of animation steps. This function is commonly used for creating animations in Angular.

When testing Angular services, you can replace a real service with a _____ to simulate service behavior.

  • component
  • mock
  • pipe
  • spy
When testing Angular services, you can replace a real service with a mock to simulate service behavior and control the service's responses for testing purposes.

You're tasked with creating a set of UI components that can be reused in non-Angular projects, such as React or Vue.js applications. Which Angular feature would be most suitable for this task?

  • Angular Directives
  • Angular Elements
  • Angular Modules
  • Angular Services
To create UI components that can be reused in non-Angular projects, you can use Angular Elements, which allows you to package Angular components as custom elements that can be used in other frameworks like React or Vue.js.