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
How to convert to the upper case?
uppercase()
26
how to convert to the String
toString()
27
how to convert to number?
isNumber()
28
how to include html from an external file?
ng-include
29
When and How to use routing?
ngRoute module | for SPA
30
Routing?
.when {template} .when .otherwise
31
What does ng-init do?
So it initializes the value of the application app
32
ng-expression mistake know this
either this {{}} | or ng-binnd="5+5"
33
Tell me the similarities/differences between angularJS and javascript
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
What's the code for making the module?
angular.module
35
So if you have the module what can you put in there?
controller, directives, filters and parts of the applications
36
How to create a directive?
``` var app=angular.module("myApp",[]); app.directive("some", function(){}); ```
37
Name the ways you can invoke a directive.
ACE - element - attribute
- comment - class
38
How do you place restrictions for each?
``` E for element C for class M for comment A for attribute so you would do restrict : A ```
39
how to include external controllers
40
What does json filter do?
Formats an object to a JSON String
41
What does limitTo do?
Limits an array/string, into a specified number of elements/characters
42
app.controller("control",function($scope, $location); What is the $location? What is the second one?
$location is the service | passed as dependency
43
Name the methods of $http service
``` .head() .delete() .get() .jsonp() .put() .post() .patch() ```
44
What are the response properties?
``` config data headers status statusText ```
45
What's the point of using ng-option and ng-repeat
ng-repeat : it has to be string | ng-option : it can be object
46
Use ng events
answer