prep for interview Flashcards

1
Q

root scope

A

every ang js app has a root scope

all the child scopes inherit fom the root scope

Each view has its own $scope (which is a child of the root scope), so whatever variables one view controller sets on its $scope variable, those variables are invisible to other controllers.

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

$inject

A

can be used to inject dependencies

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

module config block vs module run block

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

ngChange

A

do something when an input value changes

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

nghref

A

used for adding links

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

inline templates vs external templates vs internal templates

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

services vs factories vs providers

A

both of them are used to share data across controllers

the syntax is however different for both

Substitutable objects that can be wired together using DI.

· Use services to share code and data across the app.

· Angular Services are lazily initialized (initiates only when its needed)

· Angular Services are singletons per Angular module.

· Angular has many in-built services (starting with $) e.g. $rootScope, $http, $routeProviders etc.

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

$window

A

Reference to native window object.

$window.alert(“vhjbvkh”);

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

$location

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

$document

A

jQuery/jqLite wrapper for window.document

$document[0].title

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

$timeout

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

$interval

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

$templateCache

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

$http.post vs jquery.post

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

what is routing?

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

$routeProvider and ngRoute

A

it can be injected as a parameter, while implementing routing in our application;

ngRoute module is or can be injected into our app

17
Q

promise

A

http service - we make async rqst to server; using ‘get’ method for example - we can get or fetch json data from the server; this request returns a promise object with .success() and .error(); if we tell $http to fetch json , the result will be automatically be decoded into JS objects and arrays; $http returns a promise, so success() gets the data …

18
Q

links

A

or example we are creating a note-taking app; if we hover over a note - we want to display the description; so we need jquery; so how do we do this? We use links to attach or put th jquery code into the directive; This is the best spot to do any DOM manipulation or logic functionality for your directive; the three automatically injected parameters are scope, element (refers to outermost element of the included template) and attribute (refers to the attributes on the directive element);

19
Q

isolate scope

A

By passing an object to the scope option, you are creating an isolate scope. This tells the directive to keep scope inside of itself and not to inherit or share with other scopes.

20
Q

$scope vs isolate scope

A

$scope - Allows you to set values as properties on our scope object.

scope: { } - Allows you to create an isolate scope private to this directive.

21
Q

scope bindings

A
  1. Text Binding (Prefix: @) | Parsed as string and one-way binding
  2. One-way Binding (Prefix: &) | defined as getter functions and read-only inside directive’s scope
  3. Two-way Binding (Prefix: =) | Can be changed inside directive and reflects outside as well