Angular Interview Questions and Answers
Question - 31 : - Name the AngularJS components that can be injected as dependency
Answer - 31 : - AngularJS components that can be injected as a dependency are:
1) value,
2) factory,
3) service,
4) provider,
5) constant.
Question - 32 : - What are the common Angular Global API functions
Answer - 32 : - Some commonly used Angular Global API functions are:
• Angular.isString: It will return true only if the given reference is of type string.
• Angular.lowercase: It converts any string to lowercase
• Angular.uppercase: It converts any string to uppercase.
• Angular.isNumber: It returns true only if the reference is a numeric value or number.
Question - 33 : - What is BOM(Browser Object Model)?
Answer - 33 : - BOM or Browser Object Model consists of history, object navigator, screen location, etc. It specifies the global browser objects like console, local storage, and window.
Question - 34 : - Explain "$rootScope" in AngularJS
Answer - 34 : - "$rootScope" is a scope that is created on the DOM (Document Object Model) element.
An application can have only one $rootScope that shares, among other components. It has the ng-app directive. Other scopes are called as its child scope. It can watch expressions as well as propagate events.
Question - 35 : - What is the syntax of factory method in AngularJS?
Answer - 35 : - The syntax of Factory is as follows:
app.factory('serviceName',function(){ return serviceObj;})
Question - 36 : - Name different phases of the AngularJS Scope lifecycle.
Answer - 36 : - Here, are different phases of AngularJS Scope lifecycle:
• Creation
• Model mutation
• Watcher registration
• Mutation observation
• Scope destruction
Question - 37 : - Write a program for to bootstrap process in Angular
Answer - 37 : - program for to bootstrap process in Angular is:
Hi{{msg}}!
Question - 38 : - What is a single page application in AngularJS?
Answer - 38 : - SPA or single page application is a website or web application which interacts with the users dynamically. In AngularJS, JavaScript, HTML, and CSS fit on a single page. It performs navigation without refreshing the whole HTML page.
Question - 39 : - What do you mean by NPM?
Answer - 39 : - NPM stands for Node Package Manager. It consists of a command line tool client for interacting with the repository of Node.js project.
Question - 40 : - How can you create a new project in angularJS using Command Line Interface?
Answer - 40 : - Once you install the Angular command-line interface, you have to run ng new project-name command in order to create a new project in Angular.