Angular JavaScript
What is the correct way to use event-binding according to Angular 2 syntax
<button (click)="func">
What is the correct way to use property binding
<img [src]="value" />
How do you perform two-way data-binding?
<input [(ngModel)]="person.name" />
What is the correct syntax for referring to an external script called "my.js"
<script src="my.js">
Which decorator is the one used to specify metadata for the root module?
@NgModule
What is === operator?
Compares value equality as well as data type
What are Components?
Components are a major portion of Angular 2 which essentially replace controllers.
What are the three types of Directories?
Components, Structural, and Attribute
What does app.module.ts do?
Defines the AppModule component. It is the root module and will link all other components of your application here.
What are Directives?
Directives are special construct in Angular 2
What are the constructs supported in Angular 2?
Directives, Components, Interpolation
!== will perform type coercion.
False
JavaScript code is compiled before being delivered to the browser (or other platform)
False
Null is not a data type of JavaScript
False
True or False. A template is a collection of data values you pass to a component.
False
True or False. If you want to set the value of a property that is NOT a string datatype, then you can use interpolation.
False
True or False. ngIf does NOT remove the element from the DOM if the expression evaluates to false.
False
True or False. ngClass is used to add/remove multiple styles using key/value pairs of CSS
False. ngClass is used to manipulate multiple pre-defined classes at once
True of False. ngModel, ngClass, and ngStyle are examples of structural directives.
False. ngModel, ngClass and ngStyle are examples of attribute directives.
What is the benefit to using Typescript with Angular?
It supports constructs such as Decorators.
What are the JavaScript data types?
Number, String, Function, Boolean, Null, Object, undefined
What is Interpolation?
Refers to embedding expressions into marked up text.
Explain the AppComponent
The AppComponent is the Component defined in app-component.ts and serves as the main component of the application.
A callback function is a function that is an argument of another function that is typically executed before returning
True
After defining an object you can still add properties to it
True
By default, event handlers are set to the bubbling phase.
True
Does Angular support TypeScript?
True
In a typical HTML document, < document > element is the root of all other elements
True
JSON text format is syntactically identical to making objects in JavaScript
True
The HTML DOM is an object based interface that allows JavaScript and other entities manipulate and create HTML elements dynamically.
True
The number -1000, is considered truthy
True
True or False. @Directive is used for creating custom directives.
True
True or False. A Component is a specialized Directive.
True
True or False. Angular will match the selector property of the root component to an element in index.html during the bootstrapping process
True
True or False. Event-binding associates DOM events to component functions.
True
True or False. The AppComponent is typically the name for an Angular 2 application's root component.
True
True or False. You typically define one root module and typically define additional features of your application as other modules tied into your root module.
True
What is the result of the following comparison: 2 == '2'
True
You are allowed to have more than one script tag on the page for multiple JavaScript references.
True
npm uses the package.json to manage what dependencies our application has.
True
This object is used to make Ajax calls.
XMLHttpRequest
Interpolation
a way to display data from your Angular code on your templates
Which file is typically used to link your application's components?
app.module.ts
What is specified as part of the declarations property of @NgModule?
components, directives and pipes
Which properties do you specify on @NgModule
delcarations, bootstrap, imports
How can you add new DIV elements dynamically?
document.createElement('div')
What is the correct JavaScript syntax to change the content of the HTML element?
document.getElementById("demo").innerHTML = "Hello World!";
What will submit a form using JavaScript?
document.getElementById('myform').submit( )
Directives
elements, attributes and CSS style classes that you bind on your HTML templates
Services
features or values that you want defined in one location but in general are used throughout your application
Which method is best to use if you want to grab all paragraphs on the page?
getElementsByTagName()
What is true about let, var, and const?
let and const were new additions in ES6,let can be defined in block scope, const cannot be reassigned
Which file provides compilation information for an Angular2 application?
main.ts
Which is a JavaScript event?
onchange, onclick, onload
Whatis specified as part of the imports property of @NgModule?
other modules
What are valid properties of the @Component decorator
selector, template, animations, templateUrl
This function of the XMLHttpRequest object sends the request to the server?
send
Interpolation is used only for _-based values. Use _-binding for other datatypes.
string, property
Data-binding
the association of data/events with elements and user interactions