AngularJS-101 Flashcards

1
Q

What is the parent tag that mekes a web-page angular?

A

ng-app

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

Where the other tags must be defined like say ng-controller?

A

They must be defined along side or as child tag to ng-app

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

What is a Paragraph tag?

A

{{var}} it is a placeholder

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

How can we format a var?

A

You may use Paragraph tag with the vertical bar:

{{crr_time|date:’h:mm:ss a’}}

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

Can we have name to ng-app tag?

A

Yes its good , in case if we have more than one angular app in one page

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

What is ng-view annotation?

A

This tells where the dynamic data view should be loaded. Onky ine instance of ng-view is allowed. If we require some dynamism , ng-view is required , other tags will serve static purpose

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

What is a module?

A

This is how we define namespace in Angjs. It is like packages in java

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

How do we define the module

A

var modName = angular.module(‘modName’, [dependencies]), and then modName will go in ng-app

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

What is $routeProvider

A

It tells which controller to load for a url, and which htmk view to show up

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

What is the syntax for $routeProvider?

A
var rp = function($routeProvider){$routeProvider.when('/chapter/:id', {controller: 'ctrl',
templateUrl : 'template.html'}).when...
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Does route supports back and fourth of browser buttone?

A

Yes

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

By default which global variable is reached by each ng-directive for their value or function

A

$scope, and if something is not found then it goes to$rootScope

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

What is ng-model attribute?

A

ng-model takes a name , the same name looks into with . operator attached to the $scope

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

What is $location?

A

It defines the current url

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

What is $routeParams

A

The routeparams passed

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

How do you define the Controller particular to an app?

A

NGAppName.controller(‘’, function(){});

17
Q

What is the meaning of config in angukar?

A

THe config could be any workable , the config could be a $routeProvider, the $routeProvider or any injection does go to function param , and then you can use it

18
Q

How does a dependency get injected in angular?

A

Anything that gets defined in param, that way it the angular instantiate the dependency injection.

19
Q

How do you define the service or model?

A

modName.service(‘serviceName’, funtion() { this.model = function(){ return [{id : 0, data : ‘data1} , {id : 1, data ‘data2’}]}

20
Q

Can we use plain javascript or anyother js framwork

A

Yes if the other can have a var, you are good to go

21
Q

What is $id and $window

A

$id will give a unique id for the current $scope

$window will give us the window object

22
Q

What index values are given by $ng-repeat?

A

$index, $first, $last, $middle for all iterations except first and last

23
Q

Can you say an e.g. of ng-model

A

<p> {{eventName}} </p>

angular.controller(“…“,function($scope){

$scope.eventName = funtion(){
return “…”
}

})

24
Q

How does angjs provides the SPA view?

A

WIth the use of ng-view, ng-template & $routeProvider

25
Q

What is ng-model in angjs?

A

It is a ang directive to bind the value to scope, in case the var is not there , it will be created.
, this var will be made available in ctrl with scope

26
Q

What is the basic rule(format) to iterate in ng-options ?

A

item as item.key for items in arr

27
Q

How can you show /hide the element on scope.var basis

A

Use ng-show and ng-hide