Angular JS Interview Question Set 11
Categories: Angular JS
What is the difference between the $ and the $$ prefixes?
The $$ prefix is used to define a private variable in AngularJS. This is responsible for avoiding accidental code changes due to exposure to the variables. Examples are $$observers, $$watchers, $$childScope etc.
The $ prefix is used for defining built-in core AngularJS functionalities like variable, parameter, method, or any properties. Examples are $scope, $http, $routeProvider, $watch etc.
What are the main advantages of AngularJS?
Some of the main advantages of AngularJS are given below:
- Allows us to create a single page application.
- Follows MVC design pattern.
- Predefined form validations.
- Supports animations.
- Open-source.
What are the disadvantages of AngularJS?
There are some drawbacks of AngularJS which are given below:
JavaScript Dependent
If end-user disables JavaScript, AngularJS will not work.
Not Secured
It is a JavaScript-based framework, so it is not safe to authenticate the user through AngularJS only.
Time Consumption in Old Devices
The browsers on old computers and mobiles are not capable or take a little more time to render pages of application and websites designed using the framework. It happens because the browser performs some supplementary tasks like DOM (Document Object Model) manipulation.
Describe MVC in reference to angular.
AngularJS is based on MVC framework, where MVC stands for Model-View-Controller. MVCperforms the following operations:
- A model is the lowest level of the pattern responsible for maintaining data.
- A controller is responsible for a view that contains the logic to manipulate that data. It is basically a software code which is used for taking control of the interactions between the Model and View.
- A view is the HTML which is responsible for displaying the data.
What is $scope?
A $scope is an object that represents the application model for an Angular application.
Each AngularJS application can have only one root scope but can have multiple child scopes. For example:
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.carname = "Volvo";
});
Is AngularJS dependent on JQuery?
AngularJS is a JavaScript framework with key features like models, two-way binding, directives, routing, dependency injections, unit tests, etc. On the other hand, JQuery is a JavaScript library used for DOM manipulation with no two-way binding features.
What IDE's are currently used for the development of AngularJS?
A term IDE stands for Integrated Development Environment. There are some IDE's given below which are used for the development of AngularJS:
- Eclipse : It is one of the most popular IDE. It supports AngularJS plugins.
- Visual Studio : It is an IDE from Microsoft that provides a platform to develop web apps easily and instantly.
- WebStorm : It is one of the most powerful IDE for modern JavaScript development. It provides an easier way to add dependencies with angular CLI.
- Aptana : It is a customized version of Eclipse. It is free to use.
What are the features of AngularJS?
Some important features of AngularJS are given below:
MVC- In AngularJS, you just have to split your application code into MVC components, i.e., Model, View, and the Controller.
Validation- It performs client-side form validation.
Module- It defines an application.
Directive- It specifies behavior on the DOM element.
Template- It renders the dynamic view.
Scope- It joins the controller with the views.
What are the directives in AngularJS?
Directives are the markers on DOM element which are used to specify behavior on that DOM element. All AngularJS directives start with the word "ng". There are many in-built directives in AngularJS such as "ng-app", "ng-init", "ng-model", "ng-bind", "ng-repeat" etc.