General Flashcards

1
Q

Four elements of an angular app

A

components, directives, routers, services

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

Which element of angular encapsulates the template, data and the behaviour of a view?

A

Component. A component can be thought of as a “view” component.

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

Suggest an advantage of angular components being decoupled from the DOM

A

An advantage of having components decoupled from the DOM is that they are unit testable.

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

Which element of angular is used to modify the DOM and extend the behaviour of DOM elements?

A

Directives.

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

What is a .js.map file for?

A

Maps the JS code to it’s corresponding TS code in debugging.

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

What did typescript namespaces used to be called?

A

Internal modules

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

In angular what is the equivalent of a java annotation or a c# attribute?

A

Decorator

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

Translate the following code to English

import {Component} from ‘angular2/core’

A

Import the Component decorator from the angular2/core module

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

What type of code element is a decorator

A

A function

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

Create an <li> that iterates through an array of courses</li>

A

<li>{{ course }}</li>

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

Is a component a service, template or directive?

A

Directive

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

declare a button with a click handler that adds a server

A

Add Server

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

Declare an input with a 2-way binding to a first name property.

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

Declare a stop button that is enabled when the running property is true.

A

Stop

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

What does an asterisk mean in Angular

A

An asterisk prefix denotes a structural directive.

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

What is a structural directive?

A

Structural directives change the DOM

17
Q

Declare a paragraph that shows only when error is true.

A

<p>Whoops!</p>

18
Q

What would the ngIf value be to show a template called whoops if ok = false <p>good</p>

A

“ok; else whoops”

19
Q

Declare a local template containing the text “No server!” that can be referenced by noServer.

A

<p>No server!</p>

20
Q

Contrast structural and attribute directives

A

Structural directives add and remove elements whereas attribute directives only change the element they are placed on.

21
Q

How can you tell a directive is built-in?

A

Built-in directives are prefixed with ng.

22
Q

What do the square brackets mean in the following:

<p></p>

A

The square brackets mean that the ngStyle is using dataBinding

23
Q

What’s wrong with this? State two fixes.

<p></p>

A

The property background-color is not a valid java object property name. Fix 1: wrap background-color in single quotes. Fix 2: change background-color to backgroundColor (camel case).

24
Q

In a sentence:

[ngClass]=”{online: serverStatus === ‘up’}”

A

if the component’s serverStatus property equals “up” add the class “online” to the element, otherwise remove it.

25
Q

Write the directive and vlaue that outputs an array of servers.

A

*ngFor=”let server of servers”