AngularJS Interview Questions
Did you know about MVC architecture?
- MVC (Model-View-Controller), a new architecture that provide more flexibility to develop web application.
- Model: - It is responsible to maintain data.
- View: - Responsible for displaying data to user.
- Controller: - It Control and manage above two layer.
- ng-mouseenter: - Used to call events.
- ng-mouseleave: - Used when mouse cursor leave the HTML elements.
- ng-mousemove: - Used to move mouse cursor on HTML elements.
- ng-mouseover: - Used to hover mouse cursor on HTML elements.
- ng-mouseup: - Used when mouse clicked and released the HTML element.
- ng-keydown: - Used to execute custom behavior of a function immediately on keypress.
- ng-focus: - Used when input field get focus.
- ng-click:- Used to click events.
- ng-dbl-click: - Used to defined doubleclick on HTML element.
- ng-keypress: - Used to execute custom behavior of a function on keypress.
- ng-blur: - Used to fire validation.
- ng-change: - Used to change the value of input elements.
- ng-cut: - Used to define custom behavior function during cut text in HTML input field.
- ng-copy: - Used to define custom behavior function during copy text in HTML input field.
- ng- paste: - Used to define custom behavior function during paste the text in HTML input field.
Directives in Angular
Angular Directives is used for update DOM element. Angular has its own set of directives and you can also create your custom directive in Angular. Directives communicate with HTML compiler to change the various DOM elements. Angular directives start with prefix ng-. Here are some Directives of Angular
- ng-app:- The ng-app directive indicate the root of the angular application. Angular read the the HTML in the root directive.
- ng-model: - The ng-model directive used for HTML control to application data.
- ng-repeat: - This directive repeats the html element.
- ng-init: - This directives initializes application data in current scope.
- ng-Prop: - This directives bind expression to DOM.
- ngOn: - This directive add event listener to DOM.
- ngOpen: - This directive open the attribute on the element.
- ngForm: - Help to create control groups inside a form.
- ngValue: - Binds the expression to element value.
- ngClass: - Allow to set CSS class on HTML element.
Controller in Angular
The basic work of a controller is to control the flow of data in the application. In angular, controller is defined using ng-controller directive. Angular UI Bootstrap: - Large communities are using Angular and Bootstrap and sometime it has been used together in an application. All the jQuery component not used in the angular project because jQlite is already included in Angular and it’s not necessary to add jQuery. The UI Bootstrap built by Angular UI team is the best solution for developer who are using angular with bootstrap. Angular has a lots of animation so you can add ngAnimate directive to add extra dependencies. Here are some Angular UI Bootstrap directives.
Angular UI Router:
- It is a routing framework for AngularJS. When you are working on the single page application routing is very important. Angular routing module helps to navigate in application without reloading page.Routing is implemented using ngRoute module.
In latest angular js version, components are used instead of directives. Angular 2 component consists template, classes and metadata. Template : Renders application view. It contains HTML code. Class: Classes consists of methods and properties. Metadata: With decorator, data for angular js class can be defined.
Advantages of Angular JS:-
- Easy DOM manipulation: - Angular modifies the DOM page automatically instead of adding HTML.
- Two-way data binding: - Angular provide easy synchronization between Model and view.
- MVC-architecture: - MVC architecture provide more flexibility and security in application.
- Big-community support: - Angular built by Google’s engineers and team, so it provide the best support on any issue.
- Easy implementation of SPA: - Angular provide the easy way to build single page application.
- Easy to manage Hybrid application: - You can easily create cross platform application with Angular framework.
- Routing Module: - ngRoute module provide the best routing in an application without reloading the page.
- Client-side validation: - Client-side validation is inbuilt feature of angular that increase the application security.
Conclusion: - AngularJS is an open-source framework and based on secure MVC architecture. The key advantage of AngularJS is two way data binding, with this the value of view and model change automatically.
Some of the many AngularJS Interview Questions listed below will help you get an idea about what questions gets asked in such jobs related to Software Engineering & Tech. Get through the AngularJS Interview bar with our selected AngularJS Interview Questions for all AngularJS enthusiasts!