Week 8 Angular Study Guide Flashcards

1
Q

What is a framework?

A

A framework is a platform for developing software applications. It provides a foundation on which software developers can build programs for a specific platform. A framework may also include code libraries, a compiler, and other programs used in the software development process.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is Angular?

A

It is an open-source TypScript-based frontend framework developed by Google (in 2010).

It uses a component structure that represents a view on a webpage

We use Angular to create SPA’s (Single Page Applications)
- SPA’s allow for faster and more responsive web pages and a better user-experience

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What makes and Angular app?

A

TypeScript framework developed and maintained by Google.

Reusbale code through the inclusion of modules

Dynamics views through the usage of components and templates

DOM manipulation is handled through Directives

Single-page applications are created through the use of Routing

Handle Dependency Injection through the use of Services
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is TypeScript?

A

it is open-source and invented & maintained by Microsoft

it is a super-set of JS

it is strictly typed

Browsers themselves cannot interpret TS, so it must be transpiled into JS.

It has syntax closer to higher level languages like Java, and a compiler, therfore it gives us compilation errors.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is Node JS?

A

It is a JS interpreter/server environment that allows us to run JS outside of the browser.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is NPM? What does it stand for?

A

NPM = Node Package Manager

It is included in the download of Node.js and consists of a CLI (Command Line Interface) that interacts with a remote registry

Similar to maven, it can manage dependencies and versions
- This is done through the package.json file (which acts like the pom.xml).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is Angular CLI?

A

Angular CLI (Command Line Interface) is the CLI that is used to scaffold and build the Angular Project using module.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the Angular command for the CLI?

A

ng is the Angular command for the CLI

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How do you install Angular?

A

to install Angualar, we call npm install -g @angular/cli

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is Webpack? What does it do?

A

The angular CLI uses a tool called webpack which is a build automation tool.

it minifies all of our JS scripts, HTML and CSS files and bundles them together

The webpack traverses our application looking for import statements and builds a dependency graph

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What can you compare package.json to? Where is it stored? What is it for?

A

Think of the pom.xml file within your Angular project

The package.json file is stored in the root of your application

This file is used to give information to npm (node package manager) and identify all the project's dependencies and handle them.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are Angular components?

A

Components are the most basic block of an Angular app. An Angular App contains a tree of Angular Components

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the full structure of a component?

A

mycmp.component.css – the component’s private styling sheet

mycmp.component.html -- HTML Template

mycmp.component.ts -- Here we define the module, its properties, lifehooks, etc.

mycmp.component.spec.ts -- unit testing file
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How do you create a component?

A

To create a component run: ng g c mycomponent

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Where are changes added to after creating a component? What method is created?

A

As soon as we create a component, all changes are added to our app.module.ts file

As soon as the component is created, ngOnInit method is created
- this method is called by default when the class is executed.

It also has a constructor

the app component is the Parent component and any new components that we create and the Child components

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is Data-Binding?

A

Data binding is a technique to link your data to your view layer.

By binding a variable, you are telling the framework (in this case, Angular) to watch it for changes.
- If changes are detected, the framework will update the view.

17
Q

What are the types of Data-Binding?

A

One-Way Binding

Two-Way Data Binding

18
Q

Explain One-Way Binding.

A

One-way binding will bind the data from the component to the view (DOM) or from the view to the component.

This is unidirectional (we change one thing)

For example: Interpolation -> Interpolation refers to binding expressiong into marked up language (we turned the property of the app component into HTML text (as the title like so {{title}})

Interpolation allows you to incorporate properties and embed them into an HTML file with {{}};

19
Q

What is Class Binding?

A

Class binding is used to set a class property of a view element. It is a type of One-Way Binding.

20
Q

Explain Two-Way Binding.

A

2-way data binding in Angular will help users to exchange data from the component to view, and from view to component (bidirectional)

2-way databinding is a combo of Property Binding and Event Binding

2-way binding can be achieved with the [(ngModel)] directive...think banana in a box!
21
Q

What are Directives?

A

Directives change the appearence behavior or layout of the DOM (Document Object Model)

22
Q

What do Structural Directive do?

A

These change the DOM layout by adding/removing DOM elements

ngFor and ngIf

23
Q

What do Attribute Directives do?

A

These change the appearence or behavior of a particular element, component, or another directive.

We typically build these ourselves

Example:
The @Input directive is an example of and Attribute Directive.

Decorator that marks a class field as an input property and supplies configuration metadata. The input property is bound to a DOM property in the template

24
Q

What are two types of @Decorators? What do they do?

A

The @Component decorator tells Angular that we want a class to be treated as a component
- It provides the metadata for how this particular Component Class should be processed, used, and instantiated.

The @NgModule decorator takes a metadata object that describes how to compile a component’s template and how to create an injector at runtime.
- An NgModule is a class marked by the @NgModule decorator.

25
Q

What does an Angular Module Class do?

A

An Angular module class describes how the application parts fit together. Every application has at least one Angular module, the root module that you bootstrap to launch the application. You can call it anything you want. The conventional name is AppModule.

26
Q

What does the @NgModule decorator do?

A

The @NgModule decorator identifies AppModule as an Angular module class (also called an NgModule class).

@NgModule takes a metadata object that tells Angular how to compile and launch the application.
- imports — the BrowserModule that this and every application needs to run in a browser.
- declarations — the application’s lone component, which is also …
- bootstrap — the root component that Angular creates and inserts into the index.html host web page.

27
Q

What is Dependency Injection?

A

Dependency injection is a technique in which an object receives other objects that it depends on. These other objects are called dependencies.

The "injection" refers to the passing of a dependency (a service) into the object that would use it.

Dependencies are services or objects that a class needs to perform its function.
28
Q

What are Angular Services?

A

Angular services are singleton objects that get instantiated only once during the lifetime of an application.

-Services are a great way to share information among classes that don’t know each other.

-Services can depend on other services.

-The @Injectible decorator defines this as a provider, and its metadata specifies that it will be provided at the root level.

29
Q

What do Observables do?

A

Observables provide support for passing messages between parts of your application. They are used frequently in Angular and are the recommended technique for event handling, asynchronous programming, and handling multiple values.

30
Q

What is the Observable Pattern?

A

The Observer Pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of state changes. - This pattern is similar (but not identical) to the publish/subscribe design pattern.

31
Q

What does the Angular Router do? How can it affect a Single Page application?

A

The Angular Router handles navigation from one view to the next - Router enables navigation by interpreting a browser URL as in instruction to change the view.

In a Single Page Application, we change what the user sees by showing or hiding portions of the display which corresponds to particular components…instead of reaching out to a server to get a new page.