Vous êtes sur la page 1sur 9

Angular js

Angular js is powerful javascript frame work. It is used in single page


application. It extends HTML DOM with additional attributes.

Model view controller: software design pattern for developing web


application.

Ng-app: This directive defines and links an angular js application to HTML.

Ng-model: This directive bind value of angular js application data to HTML


input controls.

Ng-bind: This directive binds angular js application data to HTML tags.

What is scope in angular js?


Scopes are object that refer to model. They act as glue between controller and
view.

What is routing in angular js?


It is concept of switching view. Angular js based controller decide which
view render based on business logics.

What is factory method?


First define a factory and then assign method to it.

Var main app = angular. Module (mainApp, [ ]);

MainApp. Factory = (math service, function () {

Return factory ;});

What is dependency injection in angular js?


Dependency injection is one of the best features of angular js. It is a software
design pattern in which objects are passed as dependencies. It helps us to
remove coded dependencies and make configurable.
What is factory method in angular js, mention what are styling
from that ng model adds to CSS classes?
Ng model adds these CSS classes to aloe styling of from as well as control.

Ng- valid

Ng-invalid

Ng-pristine

Ng-dirty

What is route provider in angular js?


Rout provider is key service which set configuration URLs, map them with
corresponding HTML page or ng-template and attach a controller with same.

Var mainAPP=angular . module (mainApp,[ng route]);

mainAPP.config ([route provider,function (route provider){

route provider.

When (/addEmployee,{

templateURL :addEmployee. Html, controller:addemployee ctrl}).

Data binding ? how many types of data binding directive


provided by angular?
<ng-bind> -it updates text content of specified HTML element with value of
given expression.

<hO.ng-bind = expresstion> </h2>.

Show and hide elements:

<ng-show> , <ng-hide>

<div ng-controller =myctrl>

<div ng-show =data . ishide> ng-hide Invisible < /div >

</div>
<script>

Var app = angular . module (app , [ ] );

app . controller (myctrl, function (scope) {

$ scope . data ={};

$ scope . data . isshow = true ;

$ scope .data . ishide = true ;

});

</script>

The directive ng-if , ng-switch , ng-repeat ?

<Ng-If>

This directive can add/remove HTML elements from DOM based on


expression. If expression is true, it adds a copy of HTML element of DOM.

<div ng-controller =myctrl>

<div ng-if = data . isvisible > ng-if visible </div>

</div>

<script>

var app = angular . module (app,[ ] ) ;

app . controller (myctrl , function ($ scope ) {

$ scope .data = { } ;

$ scope . data .isvisible =true ;

});

< /script>

Ng-switch:
Child element ith <ng-switch-when> directive will be displayed if it get a
match , element and its children get removed.

< div ng . controller = myctrl >

< div ng . switch on = data . case > </div>

<div ng . switch when = 1 > case 1 </div>

<div ng switch when = 2 > case 2 </div>

</div>

< script >

var app = angular . module (app, [ ]);

app . controller (myctrl, function ( $ scope) {

$ scope . data = { };

$ scope . data . case = true ;

});

</script>

Different way to creat a service in angular js ?


5 different ways

Value
Factory
Service
Provider
Constant

$ watch ( ) ;
Use of this function to observe change in variable on scope . It trigger a
function call when value of that variable changes . It accept three parameter.

$ watch ( watch expression , listerner , [ object equality ] ).

$ digest ( ) ;
$ digest ( ) function is called whenever angular js thinks. It is necessary.

Ex: a button click , or after AJAX call.

$ Apply ;
When you apply changes to any model , that lies outside of angular context
( third party library ).

Kindly visit www.techbeamers.com for more information.

Javascript
1.) What is javascript?
It is scripting language. It is different from java language. It is widely
used for client side validation.
2.) What is difference between javascript and Jscript?
Netscape provided javascript language. Microsoft changed the
name called jscript.
You can say jscript is same as javascript.
3.) Is JavaScript is sensitive language?
Yes
4.) What is BOM?
BOM stands for browser object model. It provides interaction with
browser. The default object of browser is window.
5.) What is DOM? What is the use of document object?
DOM stands for document object model.
A document object represent HTML document.
It can be used to change and access HTML content.
6.) What is use of history object?
It can be used to switch to history page such as back and forward from
current page or another page.
1. History. Back ( )
2. History. Forward ( )
3. History. Go (number)

7.) What is difference between = = and = = =?


= = - check equality

= = = - check equality and data type (value must be same).

8.) How to create object in java script?


Three ways

By object literal
By creating instance of object
By object constructor
9.) Difference between client side and sever side JavaScript?
Client side JavaScript: comprise basic language and predefined object
which are relevant to running JavaScript in a browser.
Sever side JavaScript: also resemble like client side JavaScript. It has
relevant JavaScript which is run in server.

10.) What is difference between view state and session state?


View state is specific page in session whereas session state to a user or
browser that can be accessed across all page in web application.

11.) What are popup box available in JavaScript?


Alert box
Confirm box
Prompt box

12.) JavaScript type:


Number
String
Boolean
Function
Object
Null
Undefined

13.) What is this keyword?


This refers to object from where it was called.

14.) Does JavaScript support automatic type conversion?


Yes JavaScript support automatic type conversion, common way of type
conversion by JavaScript developer.

15.) Explain how to read and write a file in JavaScript?


Two ways

Using JavaScript extension


Using a web page and active X object.

16.) Looping structure in JavaScript?


For
While
Do-while loop

17.) What is variable typing in JavaScript?


Variable typing is used to assign a number to a variable to string.

I = 10;

I = string ;

18.) What is use of void (0)?


Void (0) is used to prevent page from refreshing and parameter
zero is passed while calling.

Void (0) is used to call another method without refreshing page.

19.) What is data type of variable in JavaScript?

All variable in JavaScript are object data type.

20.) How to find an operating system in client machine?


The navigator. Appversion find name of OS.

21.) What is difference error in JavaScript?


Load time error
Run time error
Logical error.

22.) What is unsift method in JavaScript?


Unshift method like push method which works at beginning of
array. This method is used to at prepared one or more element to beginning of
array.

23.) Explain window. Onload and on document ready?

The onload function is not run until all the information on page is loaded. This
leads to substantial delay before any code is executed.

24.) Define event bubbling?

JavaScript allows DOM elements to be nested inside each other. In


such a case, if handler of child is clicked, handler of barent will also work as of
it were clicked too.

25.) What is difference between undefined and not defined in


JavaScript?
If you try to use a variable that doesnt exist and has not been
declared, then JavaScript will throw an error var name is not defined, script will
stop executing.

Vous aimerez peut-être aussi