9 Angularjs Assignment No 9
9 Angularjs Assignment No 9
Assignment No: 09
TITLE
OBJECTIVES
1. Understand the design of single-page applications and how AngularJS facilitates their
development
2. Properly separate the model, view, and controller layers of your application and
implement them using AngularJS
3. Master AngularJS expressions, filters, and scopes
4. Build Angular forms
5. Elegantly implement Ajax in your AngularJS applications
6. Write AngularJS directives
PROBLEM STATEMENT
OUTCOMES
Students can able to,
THEORY-CONCEPT
utilize HTML as your layout dialect and gives you a chance to stretch out HTML's linguistic
structure to express your application parts plainly and compactly. Its information official and
reliance infusion take out a significant part of the code you as of now need to compose. Also,
everything occurs inside the program, making it a perfect band together with any server
innovation".
General Features
AngularJS is a productive system that can make Rich Internet Applications (RIA).
AngularJS gives designers a choices to compose customer side applications utilizing
JavaScript in a spotless Model View Controller (MVC) way.
Applications written in AngularJS are cross-program agreeable. AngularJS consequently
handles JavaScript code reasonable for every program.
AngularJS is open source, totally free, and utilized by a great many engineers the world
over. It is authorized under the Apache permit version2.0.
By and large, AngularJS is a system to assemble expansive scale, elite, and simple to-
keep up web applications.
Core Features:
2. Scope: These are objects that allude to the model. They go about as paste amongst
controller and view.
5. Filters: These select a subset of things from a cluster and restore another exhibit.
7. Templates: These are the rendered see with data from the controller and model. These
can be a solitary record, (for example, index.html) or different perspectives in a single
page utilizing partials.
9. Model View Whatever: MVW is an outline design for isolating an application into
various parts called Model, View, and Controller, each with unmistakable obligations.
AngularJS does not actualize MVC in the conventional sense, yet rather something nearer
to MVVM (Model-View-ViewModel). The Angular JS group alludes it cleverly as
Model View Whatever.
10. Deep Linking: Deep connecting permits to encode the condition of use in the URL with
the goal that it can be bookmarked. The application would then be able to be re-
established from the URL to a similar state.
Web Technology Lab Manual
11. Dependency Injection: AngularJS has a worked in reliance infusion subsystem that
encourages the designer to make, comprehend, and test the applications effectively.
Advantages of AngularJS
It gives the ability to make Single Page Application in a spotless and viable way.
It gives information restricting ability to HTML. Along these lines, it gives client a rich
and responsive experience.
AngularJS code is unit testable.
AngularJS utilizations reliance infusion and make utilization of partition of concerns.
AngularJS gives reusable segments.
With AngularJS, the engineers can accomplish greater usefulness with short code.
In AngularJS, sees are unadulterated html pages, and controllers written in JavaScript do
the business handling.
Model
The model is in charge of overseeing application information. It reacts to the demand from see and to the
directions from controller to refresh itself.
The View
An introduction of information in a specific arrangement, activated by the controller's choice to exhibit the
information. They are content based layout frameworks, for example, JSP, ASP, PHP and simple to
incorporate with AJAX innovation.
The Controller
The controller reacts to client enter and performs communications on the information show objects. The
controller gets input, approves it, and afterward performs business operations that alter the condition of the
information demonstrate.
An AngularJS application comprises of following three essential parts −ng-app − This directive
defines and links an AngularJS application to HTML.
Web Technology Lab Manual
ng-model − This directive binds the values of AngularJS application data to HTML
input controls.
ng-bind − This directive binds the AngularJS Application data to HTML tags.
DESIGN/EXECUTION STEPS
<head>
<scriptsrc="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
</head>
<body ng-app="myapp">
</body>
2. View
The view is this part −
<div ng-controller="HelloController">
<h2>Welcome {{helloTo.title}} to the world of Tutorialspoint!</h2>
</div>
ng-controller tells AngularJS what controller to use with this view. helloTo.titletells AngularJS
to write the "model" value named helloTo.title to the HTML at this location.
Web Technology Lab Manual
3. Controller
The controller part is −
<script> angular.module("myapp",
[])
.controller("HelloController",function($scope){
$scope.helloTo={};
$scope.helloTo.title="AngularJS";
});
</script>
This code registers a controller function named HelloController in the angular module
named myapp. The controller function is registered in angular via the
angular.module(...).controller(...) function call.
The $scope parameter passed to the controller function is the model. The controller function
adds a helloTo JavaScript object, and in that object it adds a title field.
4. Execution
Save the above code as myfirstexample.html and open it in any browser.
Output as below:
AngularJS directives are used to extend HTML. These are special attributes starting
with ng- prefix. We're going to discuss following directives −
ng-app − This directive starts an AngularJS Application.
ng-init − This directive initializes application data.
ng-model − This directive binds the values of AngularJS application data to
HTML
input controls.
ng-repeat − This directive repeats html elements for each item in a collection.
CONCLUSION/ANALYSIS
ORAL QUESTIONS