Learn AngularJS
Angular js introduction
- What is AngularJS?AngularJS is a framework to build large scale and high performance web application while keeping them as easy-to-maintain. Following are the features of AngularJS framework. AngularJS is a powerful JavaScript based development framework to create RICH Internet Application (RIA). AngularJS provides developers options to write client side application (using JavaScript) in a clean MVC (Model View Controller) way. Application written in AngularJS is cross-browser compliant. AngularJS automatically handles JavaScript code suitable for each browser. AngularJS is open source, completely free, and used by thousands of developers around the world. It is licensed under the Apache License version 2.0.
- What are directives in AngularJS?AngularJS has a set of built-in directives like ngBind, ngModel ngClass ngApp ngInit ngRepeat
- What are expressions in AngularJS?Expressions in AngularJS are just like JavaScript code snippets. JavaScript code is usually written inside double braces. {{expression}}. In other words, Angular Expressions are JavaScript code snippets with limited sub-set. Expressions are included in the HTML elements. Like JavaScript expressions, AngularJS expressions can also have various valid expressions. We can use the operators between numbers and strings, literals, objects and arrarys inside the expression {{ }}. For example, {{ 2 + 2 }} (numbers) {{Name + " " + email}} (string) {{ Country.Name }} (object) {{ fact[4] }} (array)
- What is currency filter in AngularJSOne of the filters in AngularJS is the Currency Filter. This “currency” filter includes the “$” Dollar Symbol as the default. So we can use the following code as the html template format of Currency Filter. {{ currency_expression | currency : symbol : fractionSize}} How to use Currency Filter in AngularJS There are two ways by which we can use Currency Filter. Default If we did not provide any currency symbol then by default Dollar-Sign will be used; we can use it as follows: Default Currency {{amount | currency}} User Defined To use different type of currency symbols we have to define our own symbol by using the unicode or Hexa-Decimal code of that Currency. E.g. - For Example If we want to define Indian Currency Symbol then we have to use (Unicode-value) or (Hexa-Decimal value) Indian Currency {{amount | currency:"&# 8377"}}
- 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. Cross-browser compliant. Supports two-way data binding. Its code is unit testable.
- 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. Difficult to Learn If you are new in AngularJS, then it will not be easy for you to deal with complex entities such as Quite layered, hierarchically and scopes. Debugging the scope is believed a tough task for many programmers.
- 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. For example, a $scope can be defined as a model, whereas the functions written in angular controller modifies the $scope and HTML displays the value of scope variable.
- 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"; });
- 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. Expression- It binds application data to HTML. Data Binding- It creates a two-way data-binding between the selected element and the $ctrl.orderProp model. Filter- It provides the filter to format data. Service- It stores and shares data across the application. Routing- It is used to build a single page application. Dependency Injection- It specifies a design pattern in which components are given their dependencies instead of hard-coding them within the component. Testing- It is easy to test any of the AngularJS components through unit testing and end-to-end testing.
4iv>