Angular Fundamentals

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

What decorator function does a component need to be considered a component?

@Component()

What is an angular application comprised of?

A tree of components.

How does dependency injection work in angular?

Components shouldn't save or fetch data directly. They delegate their data access to a service. Import { Injectable } from '@angular/core' to use the @injectable() decorator. The @injectable() decorator accepts a metadata object for the service.

What is a workspace?

It contains all the files for one or more projects.

What does the CLI create when making a component?

It creates a new folder for each component and generates a .css, .ts, and a .html file inside it.

What is ngOnInit()?

It is a lifecycle hook, it is a good place for component initialization logic like getting current data from a service.

What is angular?

It is an application design framework and development platform for creating efficient and sophisticated single-page apps.

What is a service?

It is an instance of a class that you can make part of your application using angular's dependency injection system. It is the place where you share data between the parts of your application.

What is a project?

It is the set of files that comprise an app, a library, or end-to-end (e2e) tests

What does every component need declared in order to function?

It must be declared in the NgModule to function. When a new component is declared, Angular CLI automatically delcares it under the @NgModule.declarations array on generation.

What does a @Component() decorator contain?

It specifies the angular metadata for the component: 1. The selector name to use for CSS and if importing this component turns it into a .html page 2. The relative .html location 3. The relative .css location

What are components?

They are the fundamental building blocks of angular applications. They display data on the screen, listen for user input, and take action based on that input.

What is the purpose of providing a service at the root level?

When a service is provided at the root level, angular creates a single, shared instance of the service and injects it into any class that asks for it.

How to make a service available to Angular's dependency injection system?

You must register a provider. By default the Angular CLI comand ng generate service registers a provider with the root injector for your service. It provides the service at the root level.

What is the purpose of interfaces in Angular?

when you want to define a class or objects, and then import it in various components.

What imports are always on the top of a component class?

{ Component, OnInit } from @angular/core


Set pelajaran terkait

National Topic Tester - Mandated Disclosures

View Set

Membrane Electrophysiology & RMP

View Set

Chapter 30 Abdominal and Genitourinary Injuries

View Set

Century of Conflict - WWI Study Guide

View Set

EPIC Insurance Exam: Health Section

View Set

Ch 14 Video Assignment Marketing

View Set

Cell bio - Chapter 18 Practice Questions

View Set