angularInterview Flashcards

1
Q

What is ng-directive?

A

So this is the thing that angular extends html with

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

What is ng-app?

A

Well a directive. need it so to define angular js app

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

What is the ng-model

A

it binds the value of input field with the application variable
For eg
so like it binds the input value with the name var

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

What is ng-bind?

A

so this one binds application data with the HTML view.

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

how do you write angular js expressions?

A

in the {{}}
eg : {{9+9}}}
{{func()}}
and also this can be used to bind.

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

what is the ng-controller?

A

Controls the Angular js application

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

What is ng-module for?

A

defining the angular js application

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

Write a code to define a module and a controller.

A
var app=angular.module("myApp", []);
app.controller("myController", function($scope){//write functions});
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the two ways you can write expressions?

A

<p></p>

{{5+5}}

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

ng-init purpose?

A
var i=0;
to initialize the values to the variables
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

create an object in angular using the ng-init :

A

<div>

| {{league.adc}}</div>

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

What angularJS expression contain?

A
like js, 
Literals
operators
variable
LOV = literals operators and variables
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Difference between angular expression and javascript expression

A

angular js can be written inside the HTML

Angular doesnt support conditionals, loops and exceptions while js does

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

What is the angularJS module?

A
  • defines an application
  • is a container for the different parts of an application, container for the application controller
    and controllers always belong to the module
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

$scope

$rootScope

A

$rootScope is the global one

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

angular is one way or two way? WHY?

A

two-way binding.

cause angularjs is the synchronization between the model and the view.

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

what is a scope?

A

the binding part between the HTML(view) and the JS(controller)
So available for both the view and the controller.
$scope is the object

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

what is filter?

A

added to expression by using | , followed by the filter

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

$http

A

makes a request to the server and returns a response

20
Q

What are the methods of $http

A
.delete()
.get()
.head()
.jsonp()
.patch()
.post()
.put()
21
Q

What are the properties of http?

A
.config : object that generates request
.header : function to get header information
.status : number of the HTTP status
.statusText : string of the http status
.data : carries response from the server
22
Q
100
200
300
400
500
A
100-informational
200-success
300-redirect
400-client
500-server error
23
Q

name angularjs events

A

ng-blur
ng-click
ng-copy
ng-page

24
Q

What is the API to convert to lower case?

A

lowercase()

25
Q

How to convert to the upper case?

A

uppercase()

26
Q

how to convert to the String

A

toString()

27
Q

how to convert to number?

A

isNumber()

28
Q

how to include html from an external file?

A

ng-include

29
Q

When and How to use routing?

A

ngRoute module

for SPA

30
Q

Routing?

A

.when
{template}
.when
.otherwise

31
Q

What does ng-init do?

A

So it initializes the value of the application app

32
Q

ng-expression mistake know this

A

either this {{}}

or ng-binnd=”5+5”

33
Q

Tell me the similarities/differences between angularJS and javascript

A

Similarities they both have Literals, Operators and Varaiables
Differences
Angular expression can be written inside the HTML
Angular supports filters but javascript does not.
It doesn’t support loops, conditionals, exceptions

34
Q

What’s the code for making the module?

A

angular.module

35
Q

So if you have the module what can you put in there?

A

controller, directives, filters and parts of the applications

36
Q

How to create a directive?

A
var app=angular.module("myApp",[]);
app.directive("some", function(){});
37
Q

Name the ways you can invoke a directive.

A

ACE

  • element
  • attribute <div></div>
  • comment
  • class <div class="some"></div>
38
Q

How do you place restrictions for each?

A
E for element
C for class
M for comment
A for attribute
so you would do
restrict : A
39
Q

how to include external controllers

A
40
Q

What does json filter do?

A

Formats an object to a JSON String

41
Q

What does limitTo do?

A

Limits an array/string, into a specified number of elements/characters

42
Q

app.controller(“control”,function($scope, $location); What is the $location? What is the second one?

A

$location is the service

passed as dependency

43
Q

Name the methods of $http service

A
.head()
.delete()
.get()
.jsonp()
.put()
.post()
.patch()
44
Q

What are the response properties?

A
config
data
headers
status
statusText
45
Q

What’s the point of using ng-option and ng-repeat

A

ng-repeat : it has to be string

ng-option : it can be object

46
Q

Use ng events

A

answer