Mcad2233 Open-Source Technologies
Mcad2233 Open-Source Technologies
APPLICATIONS
MCAD2233
OPEN SOURCE
TECHNOLOGIES Third
Semester
Information contained in this book has been obtained by its Author(s) from sources believed to
be reliable and are correct to the best of their knowledge. However Publishers and the Author(s)
shall inno event be liable for any errors, omissions or damages arising out of this information
and specifically disclaim any implied warranties or merchantability or fitness for any
particular.
UNIT-1 Introduction
Open Source, Need and Principles of OSS, Open-Source Standards, Requirements for Software,
OSS success, Free Software, Examples, Licensing, Free Vs. Proprietary Software, Free Software
Vs. Open-Source Software, Public Domain. History of free software, Proprietary Vs Open-Source
Licensing Model, use of Open- Source Software, FOSS does not mean no cost. History: BSD, The
Free Software Foundation and the GNU Project.
Unit 3- Angular JS
Introduction and Agenda - Prerequisites - What are SPA's - Introduction to AngularJS - Features
of AngularJS - MVC Architecture - Versions and Transitions - Environmental Setup - Angular JS
IDE's - Introduction to Visual studio code - Angular app fundamentals - Simple AngularJS App -
Companies using Angular JS - Advantages of Angular JS.
Unit 4-Mongo DB
Introduction to Mongodb- Installing Mongo DB in Windows, Linux and Mac Operating Systems -
Installing and Working with MongoDB interfaces: i)Mongo Shell, ii)Mongo Compass - Mongodb
Datatypes: i)Integer ii)Boolean iii)Double iv)String v)Arrays vi)Object vii)Null viii)Regular
expression ix)Timestamp x)Date xi)Object ID - Introduction to entities of MongoDB: i)Databases
i)Collections and iii)Documents - Database: i)createDatabase()method with example,
ii)dropDatabase() method with example - Collections: i)createCollection() method with example
ii)dropCollection() method with example
Unit 5 – Mongo DB
Indexes: Properties of Index, i)Unique Indexes, ii)Partial Indexes, iii)Sparse Indexes, iv)TTL
Indexes - Aggregation in Mongodb: i)aggregate() method - Aggregate expressions: i) $sum ii)
$avg iii) $min iv) $max v) $push vi) $addToSet vii) $first viii) $last - Mongodb Backup:
Export/Import data backup using shell - i)mongodump, ii)mongorestore - Mongodb Backup:
Export/Import data backup using Mongo Compass - Monitoring Deployment using Mongodb:
i)mongostat, mongotop, iii)serverStatus, dbStats, collStats
TEXTBOOK:
James Lee and Brent Ware, “Open-Source Web Development with LAMP using Linux, Apache,
MySQL, Perl and PHP”.
Learning AngularJS, Free eBook created from Stack Overflow contributors.
MongoDB: The Definitive Guide, Book by Kristina Chodorow and Michael Dirolf
WEB REFERENCES
www.w3schools.com, www.php.net, www.phpclasses.org www.tizag.com,
www.tutorialspoint.com, www.perl.org, www.oracle.com
10 5 10 5
Total 15 15 30
Total 100
STRUCTURE
1.11 History: BSD, the Free Software Foundation and the GNU Project.
Open source software is software with source code that anyone can
inspect, modify, and enhance. "Source code" is the part of software that
most computer users don't ever see; it's the code computer
programmers can manipulate to change how a piece of software—a
"program" or "application"—works. Programmers who have access to
a computer program's source code can improve that program by adding
features to it or fixing parts that don't always work correctly.
The license shall not restrict any party from selling or giving away the
software as a component of an aggregate software distribution containing
programs from several different sources. The license shall not require a royalty
or other fee for such sale.
The program must include source code, and must allow distribution in source
code as well as compiled form. Where some form of a product is not
distributed with source code, there must be a well-publicized means of
obtaining the source code for no more than a reasonable reproduction cost,
preferably downloading via the Internet without charge.
The license must allow modifications and derived works, and must allow them
to be distributed under the same terms as the license of the original software.
The license may restrict source-code from being distributed in modified form
only if the license allows the distribution of “patch files” with the source code
for the purpose of modifying the program at build time. The license must
explicitly permit distribution of software built from modified source code. The
4 SRMIST DDE MCA Self Instructional Material
license may require derived works to carry a The rights attached to the program must not
different name or version number from the depend on the program’s being part of a
original software. particular software distribution. If the program is
extracted from that distribution and used or
1.4.5. No Discrimination against Persons or
Groups distributed within the terms of the program’s
license, all parties to whom the program is
The license must not discriminate against any redistributed should have the same rights as
those that are granted in conjunction with the
person or group of persons. 1.4.6. No
original software distribution.
Discrimination against Fields of Endeavor
1.4.9. License Must Not Restrict Other
The license must not restrict anyone from Software
making use of the program in a specific field of
The license must not place restrictions on other
endeavour. For example, it may not restrict the
software that is distributed along with the
program from being used in a business, or from
licensed software. For example, the license must
being used for genetic research.
not insist that all other programs distributed on
The rights attached to the program must apply to 1.4.10. License Must Be Technology-Neutral
all to whom the program is redistributed without
No provision of the license may be predicated on
the need for execution of an additional license by
any individual technology or style of interface.
those parties.
1.5 FREE SOFTWARE, EXAMPLES
1.4.8. License Must Not Be Specific to a
Product NOTES
5 | SRMIST DDE MCA Self Instructional Material
1.5.1 FREE SOFTWARE
“Free software” means software that respects users' freedom and community.
Roughly, it means that the users have the freedom to run, copy, distribute,
study, change and improve the software. Thus, “free software” is a matter of
liberty, not price.
A program is free software if the program's users have the four essential
freedoms:
▪ The freedom to run the program as you wish, for any purpose (freedom
0).
▪ The freedom to study how the program works, and change it so it does
your computing as you wish (freedom 1). Access to the source code is
a precondition for this.
▪ The freedom to redistribute copies so you can help others (freedom 2).
1.5.2 EXAMPLES
Few examples for Free software are listed below and are not limited to this.
The difference between open source and free software comes into play
when you distribute software based on FOSS code. The biggest proponent of
free software is the Free Software Foundation, which has published several
widely used licenses. They’re called GNU licenses, after the GNU family of
software products. The GNU General Public License (GPL) is the archetype
for free software licenses.
The key point of the GPL is that it’s “sticky.” If you use GPL-licensed
software in a modified form or incorporate it into your product, you have to
make it available under the same terms. You can sell the software, but you
also have to make its source code freely available. Free software advocates
call granting rights this way “copyleft.”
8 SRMIST DDE MCA Self Instructional Material
Open source licenses generally don’t impose this restriction. They may place other requirements
on the code, such as clearly identifying modified different benefits and drawbacks, depending on
versions. the developer’s purpose. These are some of the
best known.
1.8 PUBLIC DOMAIN
1.9.2 Open source licenses
The public domain (PD) consists of all the
creative work to which no exclusive intellectual ∙ MIT License: A very brief open source license
property rights apply. Those rights may have that doesn’t require an MIT degree to
expired, been forfeited, expressly waived, or mayunderstand it. The only requirement is to include
be inapplicable. Because no one holds the the license and copyright notice when
exclusive rights, anyone can legally use or distributing copies.
reference those works without permission.
∙ BSD License: A short, simple set of licenses.
In India, copyright generally lasts for sixty years
The two-clause license is nearly equivalent to
after the death of the author or sixty years after
the MIT License, except that it requires
the publication of the work, depending on the
distributing the license with any copies. The
nature of the content. As a result, when the term
three-clause license adds a restriction on using
expires, the content is released into the public
the licensor’s name for publicity.
domain.
∙ Creative Commons licenses: A family of
1.9 PROPRIETARY VS OPEN-SOURCE
licenses placing different restrictions. Software
LICENSING MODEL 1.9.1 LICENSING creators can choose the conditions they prefer for
∙ Apache License: A widely used open source license from the Apache
Software Foundation. It licenses patents to the extent possible, requires
notice of any modifications that are distributed, and includes various
legal disclaimers.
∙ GNU Affero General Public License: The AGPL is even stickier than
the GPL. Its stickiness extends to code which runs on servers, even if
it’s never published. The rise of cloud services has made this a
common situation.
By the 1980s, almost all software was proprietary, which means that it had
owners who forbid and prevent cooperation by users. This made the GNU
Project necessary.
STRUCTURE
2.8 LAMP
The open-source operating system allows the use of code that is freely
distributed and available to anyone and for commercial purposes. Being an
open-source application or program, the program source code of an open
source OS is available. The user may modify or change those codes and
develop new applications according to the user requirement. Some basic
examples of the open-source operating systems are Linux, Open Solaris,
Free RTOS, Open BDS, Free BSD, Minix, etc.
Most of the open-source operating systems are Linux based. Some of the best
open-source operating systems are as follows:
1. Linux Kernel
2. Linux Lite
Linux Lite is another free and open-source operating system that can
run on lower-end hardware. It is a lightweight operating system designed to
help users who are unfamiliar with Linux-based operating systems. The
operating system includes all of the required programs, capabilities, tools, and
desktops. It has a minimal interface and is entirely based on the Ubuntu
system.
3. Linux mint
Ubuntu. 4. Fedora
community-based OS may run Windows apps, for your desktop computer. It's a new operating
making it an excellent alternative to the system from the Linux family, released in 2012.
Windows operating system. Although ReactOS More than 6000 registered users are currently
is still growing, users, who love highly using the software. VLC, XChat, Transmission,
customizable operating systems, can select Thunderbird, OpenShot Video Editor, Firefox,
ReactOS. However, the operating system is Budgie desktop environment, and LibreOffice
Suite are all included with Solus. The most 2.2 OPEN SOURCE HARDWARE
recent version of Solus, Solus 3, was released in
"Open hardware," or "open source hardware,"
August 2017.
refers to the design specifications of a physical
7. Chrome OS object which are licensed in such a way that said
object can be studied, modified, created, and
Chrome OS is a partly open-source operating distributed by anyone.
system with various attractive features. It's a
part of the Chromium and Linux families, with "Open hardware" is a set of design principles and
features including better security, compatibility legal practices, not a specific type of object. The
for supported Android and Chrome apps, Aura term can therefore refer to any number of objects
windows manager, Google cloud print, — like automobiles, chairs, computers, robots, or
integrated media player, virtual desktop access, even houses.
and cloud-based management. The only issue
NOTES
with the operating system is that it only supports
Nexus devices or its hardware.
19 | SRMIST DDE MCA Self Instructional Material
▪ Like open source software, the "source code" for open hardware—
schematics, blueprints, logic designs, Computer Aided Design (CAD)
drawings or files, etc.—is available for modification or enhancement
by anyone under permissive licenses.
▪ Users with access to the tools that can read and manipulate these source
files can update and improve the code that underlies the physical
device. They can add features or fix bugs in the software. They can
even modify the physical design of the object itself and, if they wish,
proceed to share such modifications.
Each VM runs its own operating system (OS) and behaves like an independent
computer, even though it is running on just a portion of the actual underlying
computer hardware.
20 SRMIST DDE MCA Self Instructional Material
NOTES 2.4
CONTAINERIZATION TECHNOLOGIES
2.4.1 What is a Containerization technology?
Docker
An open-sourced containerized platform that combines the source code of an
app with the existing OS and its respective libraries and dependencies. It lets
the said code run on any computing environment.
LXC
An OS-based container that allows an app to run on multiple Linux systems on
a virtual level, given it has a single Linux kernel that serves as the host OS.
CRI-O
It is a Container Runtime Interface (CRI) for Kubernetes, a container cluster
management platform. It is a CRI to ensure that it follows the OCI compatible
runtimes. As a result, this tool serves as a replacement for Docker with
Kubernetes.
∙ Reduction in infrastructure cost since many Open source development tools are software
containers can run on a single machine or even a applications and resources that are freely
Virtual Machine (VM). available for developers to use, modify, and
distribute under open source licenses. These
∙ Monolithic or legacy applications could be
tools are essential for open source software
containerized using microservice architecture,
development and are widely used in various
making room for future scaling.
stages of the development process. Here are
∙ Improves application security since the app will some popular open source development tools
be stored in separate containers on different across different categories:
NOTES
23 | SRMIST DDE MCA Self Instructional Material
Eclipse: An open source IDE primarily used for Java development but
extensible to support other languages through plugins.
Git: The most widely used distributed version control system. Git is the
foundation of platforms like GitHub, GitLab, and Bitbucket.
npm (Node Package Manager): A package JUnit: A widely used testing framework for Java
manager for JavaScript and Node.js. It allows applications.
Features:
PyCharm is the most popular IDE used for Python scripting language. This
chapter will give you an introduction to PyCharm and explains its features.
PyCharm offers some of the best features to its users and developers in the
following aspects −
∙ Advanced debugging
Features of PyCharm
Code Completion
SQLAlchemy as Debugger
You can set a breakpoint, pause in the debugger and can see the SQL
representation of the user expression for SQL Language code.
When coding in Python, queries are normal for a developer. You can check
the last commit easily in PyCharm as it has the blue sections that can define
the difference between the last commit and the current one.
30 SRMIST DDE MCA Self Instructional Material
Code Coverage in Editor more files at a time and PyCharm includes
various shortcuts for a smooth refactoring
You can run .py files outside PyCharm Editor as process.
well marking it as code coverage details
elsewhere in the project tree, in the summary
section etc.
Language Support: Primarily designed for
Python development.
Package Management
2.6.2.2Airbrake
o Real-time error alerts. You can discover errors right down to the lines of
code.
o Easy installation.
o Low maintenance.
2.6.2.6 Memfault
Memfault is modular and can work with Android or any real-time operating
system, allowing you to scale the devices and build better and smarter IoT
devices.
2.6.2.7 GDB
For UNIX systems and several programming languages, including C and C++,
GDB, or GNU Project Debugger is an open-source debugging tool. It has a
command line interface where the developer can perform various tasks, call
functions independently and monitor different internal variables, also allowing
you to debug remotely.
2.6.2.9 SonarLint
The IBM Rational Software Analyzer also
SonarLint is an IDE extension that makes sure provides seamless integrations with third-party
that your coding is error free and of the highest tools.
calibre possible. From the moment you begin
o Higher focus on coding and product
coding, it helps in identifying bugs and development
correcting defects and security-related problems.
o Useful when the investment on QA is high
The flaws are displayed similarly to a spell
o Allows you to do the fixings early on in the
checker so they can be rectified before the code SDC
commits. SonarQube is a different tool, however,
SonarLint is favoured since it provides 2.7 PROGRAMMING LANGUAGES
immediate feedback.
20. Erlang
NOTES
35 | SRMIST DDE MCA Self Instructional Material
One of the latest programming languages to be introduced to the world of
software engineering is Erlang. Already gaining traction in the computer
software market, Erlang is designed for general-purpose programming with
run-time, distributive, and hot-swapping features.
19. Elixir
Another runoff language program built on the core design principles of Erlang
is Elixir. Elixir has high-impact capabilities that use the same run-time
features (BEAM) like Erlang. It supports advanced functions like
polymorphism, macros, and metaprogramming.
18. Haskell
Haskell is a relatively new entrant, but it is worthy of its place on our list due
to its increasing popularity among software developers. Named after Haskell
Curry, its original developer, this language program is based on Miranda’s
lazy approach functionality. Haskell started gaining wide recognition after
Facebook built its anti-spam mechanism with it.
17 Perl
Perl used to be one of the most popular language programs in the past but fell
behind the competition in later years; however, it has still remained relevant
against all the odds. Originally intended for general-purpose programming for
text manipulation, users gradually implemented it for web and network
development in systems.
16. Scala
Thanks to the innovative features of Scala for both functional and objective
programming, Scala reduces system bugs during system designs and
development. Not as popular as the Pythons and Java’s of the software world,
but Scala is still holding its place among the list of top language programs in
use today.
15. Kotlin
9. TypeScript
8. Swift
7. Shell
Not many may know about Shell if they have never worked on Open source
projects or rarely do, but this language program is very popular among IT
companies. Shell is a highly resourceful language that allows the developer to
directly write codes that dictate to the computer system what to do. Some
actions Shell can be used for include files copying, data backup, installing, and
uninstalling programs directly or remotely.
NOTES 6. C++ Dating as far back as 1979, C++ was created by Bjarne Stroustrup for his Ph.D.
thesis. This language program was designed using C as a background program. With C being
an open-source program, he simply added new features to create C++. Some programs that use
C++ today include computer games, web browsers, and operating systems.
5. C#
4. PHP
This open-source program is meant for the creation of interactive web pages
and for general web development. Large concerns like Yahoo and Facebook
also use it to operate their databases. Originally called Hypertext Preprocessor,
PHP is not without its critics, but it still remains relevant and widely used by
both freelance developers and large corporations.
3. Java
There was no way Java wasn’t going to make the top ten list since it is one of
the most popular language programs in the world today. Now owned by
Oracle, Java was initially developed in 1995 by Sun Microsystems. Today, it
is used by some of the largest companies you can think of like Netflix and
Twitter, to mention a few. In fact, Java has become a standard language
program for large organizations that work with big platforms that process a lot
of data. With Java, you can create database software, web applications, and
mobile applications. Another thing that makes Java a dynamic program is
down to the fact that you can switch from C# to C++ languages at any time
since it was developed using C as its root program.
2. Python
1. JavaScript
The number one programming language on our list for open-source projects is
JavaScript. Javascript is used to build web pages and ensures that websites are
highly interactive. It is flexible but yet powerful for improving the interaction
between single or multiple users. That is not to say that JavaScript is only used
for websites. Developers also use it to build games too.
2.8 LAMP
Web developers choose a LAMP stack to build web applications for the
following reasons.
Cost
All LAMP technologies are open source, which means that any developer or
company can use them without having to pay licensing fees. Instead of
purchasing proprietary stack components, you can download the operating
technologies so that they remain relevant and A LAMP stack is used for backend or server-side
secure. development. A backend application is software
that runs in an environment that’s hidden from
Support
end users. Backend applications consist of the
Popular open-source technologies, such as following:
LAMP stacks, have the support of a large,
global IT community. Hence, LAMP stack users ∙ Data processing software
can more easily find information on public IT
∙ Database components
forums. Web developers can refer to example
codes or use tested plugins created by the open- NOTES
source community.
41 | SRMIST DDE MCA Self Instructional Material
∙ Business logic in code
The webpage that shows up on your browser is called the frontend application.
When you interact with the page, such as by clicking on a button, your
browser communicates with the backend application to retrieve the required
information.
Developers use a LAMP stack to create both static and dynamic web content.
Static webpages
Static webpage information from the web server is the same for all users. For
example, the address on a company's website is static content. Web developers
create static webpages with HTML and CSS programming languages and store
them as files in the web server application.
Dynamic webpages
Linux is an open-source operating system that management system and is the third layer of the
you can install and configure to meet different LAMP stack. The LAMP model uses MySQL
application requirements. Linux sits at the first for storing, managing, and querying information
level of the LAMP stack and supports other in relational databases. For example, developers
components on the upper layers. store application data, such as customer records,
sales, and inventories. When a user searches for
Apache information, the web server queries the stored
Apache is an open-source web server that forms data in MySQL. Query refers to special
the second layer of the LAMP stack. The instructions for manipulating data in a relational
Apache module stores website files and database with the SQL language.
exchanges information with a browser using
PHP
HTTP, an internet protocol for transferring
website information in plain text. For example, PHP, which stands for PHP: Hypertext
when a browser requests a webpage, the Apache Preprocessor, is the fourth and final layer of the
HTTP server does the following: LAMP stack. It is a scripting language that
allows websites to run dynamic processes. A
1. Receives the request dynamic process involves information in
2. Processes the request and finds the required software that constantly changes. Web
page file developers embed the PHP programming
3. Sends the relevant information back to the language in HTML to show real-time or updated
browser information on websites. They use PHP
MySQL NOTES
43 | SRMIST DDE MCA Self Instructional Material
to allow the web server, database, and operating system to cohesively process
requests from browsers.
PHP started out as a small open source project that evolved as more and more
people found out how useful it was. Rasmus Lerdorf unleashed the first
version of PHP way back in 1994.
2.9.1 Introduction
2.9.2.6 Redis:
2.9.2.7 Elasticsearch:
2.9.2.8 MariaDB:
2.9.2.9 Neo4j:
References
[1] https://www.freecodecamp.org/
[2] https://www.javatpoint.com/
[3] https://www.geeksforgeeks.org
[4] https://www.simform.com/blog/containerization-technology/
Unit-3 ANGULAR JS
STRUCTURE
3.2 PREREQUISITES
▪ Error handling
System Requirements
This way, users can view a website without loading the entire new
page and data from the server. As a result, performance increases, and
you feel like using a native application. It offers a more dynamic web
experience to the users. SPAs help users be in a single, uncomplicated
web space in easy, workable, and simple ways.
Gmail, Facebook, Trello, Google Maps, etc., all are Single Page
Applications that offer an outstanding user experience in the browser
with no page reloading.
For instance, when you open your Gmail account, you can see nothing
changes much during navigation. Its header and sidebar are the same in
50 SRMIST DDE MCA Self Instructional Material
the inbox, and when a new email arrives, it Using a SPA, the server sends the HTML
reflects the change quickly by loading its document only for the first request, and for
content via JavaScript. subsequent requests, it sends JSON data. This
means a SPA will rewrite the current page’s
3.2.2 How SPA works? content and not reload the whole web page.
Hence, no need to wait extra for reloading and
The architecture of Single page applications is
faster performance. This capability makes a
simple. It involves client-side and server-side
SPA behave like a native application.
rendering technologies.
A Single Page Application is different from
multi-page applications (MPAs). The latter are
web apps with multiple pages reloaded when a
user requests new data.
NOTES
51 | SRMIST DDE MCA Self Instructional Material
3.2.3 Advantages of SPA
Better speed
Web applications must offer faster speed and not waste users’ time;
otherwise, users can find other efficient venues. SPAs provide shorter
response times as the entire page doesn’t have to reload and only the
data changes in the requested content parts. Thus, the web app’s speed
improves considerably.
Efficient caching
Simplified development
NOTES
53 | SRMIST DDE MCA Self Instructional Material
Less resource consumption
Single Page Apps consume less bandwidth as they load the pages just
once. They also work in areas with a slower internet connection, hence,
convenient to use for everyone. Besides, they work offline, saving your
data, so you don’t have to supply them with consistent internet to
access and work on them, unlike MPAs like Google Docs.
Cross-platform compatibility
The SPAs architecture involves just a single page with a single URL. It
limits the SPAs’ ability to benefit from search engine optimization
(SEO). SEO techniques help improve your site’s ranking in the search
engine results, as there’s high competition out there.
Online threats
3.3.1 What is AngularJs? The birth year of AngularJS was 2010. It was
developing single-page web applications.It is Tech LLC. The framework was created as the
considered to be a preferred framework because software behind an online JSON storage service
it can be easily added to HTML pages with for easy-to-make applications for the enterprise.
It is also known for one of its exclusive features, year 2009, when Miško Hevery was working on
i.e. Angular.js converts the static HTML to a part-time project to simplify the web
dynamic HTML and also offers dynamic development process. He created the AngularJS
binding.It has consistently evolved and is framework so that there can be a static web
currently known for offering much more server that will help in building simple web
advanced ways to develop better web applications. Now, Adam Abrons, who was
∙ Build optimizer: This tool aids in the removal of unwanted code from
your program.
∙ Angular Universal State Transfer API and DOM Support — With this
functionality, we can simply transfer the application's state between the
server and client sides.
Angular 6
∙ This release focuses less on the underlying framework and more on the
toolchain and enables future angular development easier.
Angular7
∙ Compiler Update
SPAs come with a lot of benefits but also drawbacks, as you saw in the
previous section. So, it’s not wise to say that it’s entirely good or bad.
It depends upon your requirements and goals to create an application.
Features of Angular JS
59 | SRMIST DDE MCA Self Instructional Material
6. The AngularJS Router: This framework's router serves a specific
purpose. It ignores the location.hash, unlike other frameworks. The
router monitors and checks for the location.hash in those frameworks,
then runs the function after the route matches. In AngularJS, it serves
as a server-side router.
7. User Interface with HTML: AngularJS uses User Interface with HTML
to construct the user interface, which sets it apart from other
frameworks. Angular makes using and executing short labels a breeze.
It provides a very improved interface without adding additional
expenditures.
8. Directives: This is one of AngularJS's standout features and
distinguishes it from competing frameworks. Directives are qualities
that begin with the letter ng- before the action, they perform. Mandates
allowed developers and design teams to segment practices into the
Document Object Model (DOM), allowing software architects to
create dynamic HTML components.
3.5.1 INTRODUCTION
3.5.2.3 Controller
Model:
1. It is the domain-specific representation of the data on which the
application works.
2. When a model changes its state, domain notifies its associated views
so they can refresh.
View:
1. Renders the model into a form suitable for interaction, typically a
user interface element. Multiple views can exist for a single model for
different purposes.
2. In web applications where the view is the HTML or XHTML
generated by the app.
Controller:
1. Receives input and initiates a response by making calls on model
objects.
2. In web applications, the controller receives GET or POST input and
decides its own action.
This command ng new installs all the necessary packages, files, and
dependencies and creates a workspace by the name ‘my-app.’ In this
workspace, the following project files are created:
The workspace contains the initial project with a welcome application. Now,
you’re ready to create your first Angular component and serve the application.
Over the years, AngularJS has become a staple of web development, whether
for web apps or pages. A big community has grown alongside it, providing a
lot of code snippets and other equally useful tools to help other developers
with common problems. Let’s take a look at some of the best AngularJS
development tools!
3.8.1 WebStorm
Angular IDE is an extension for the MyEclipse Java IDE that allows
developers to develop Angular projects natively. It features wizards to ease the
creation and set up of projects, but also of components, services and modules,
which speeds up development significantly. It also has a handy feature in the
form of CodeLive, a tool to inspect which elements and Angular Components
are being loaded on the web page.
Sublime Text has long been considered a very lightweight and stable
code editor and has become even more so with its recent 4th version. With this
version, several useful features for Angular developers were introduced or
improved, namely GPU rendering, context-aware autocomplete and Support
for Javascript shipped by default. It also provides a Python API that allows for
the development of extensions, and its extension ecosystem has a vibrant
community.
3.8.6 JSFiddle
Unlike other IDEs on this list, JSFiddle stands out by being a solid
online solution to develop and debug, providing separate windows for HTML,
CSS, JavaScript, and Angular all in one place for easy editing. Plus, it also
allows for real-time collaboration. It is extremely useful to develop small code
snippets or to test out new ideas.
3.9.1 Introduction
In this [], we can add a list of components needed but we are not including any
components in this case. This created module is bound with any tag like div,
body, etc by adding it to the list of modules.
</div>
Adding a Controller:
app.controller("Controller-name", function($scope) {
$scope.variable-name= "";
});
3.10.3 Directives
68 SRMIST DDE MCA Self Instructional Material
The ngModel directive is a directive that is used to bind the values of the HTML controls (input,
select, and textarea) or any custom form controls,time, the view is a projection of the model.
and stores the required user value in a variable Unlike React, angular supports two-way binding.
and we can use that variable whenever we In this way, we can make the code more loosely
require that value. It also is used during form coupled. Data binding can be categorized into 2
validations. The various form input types (text, types, ie., One-way Binding & Two-way
checkbox, radio, number, email, URL, date, Binding.
datetime-local time, month, week) can be used One-way Binding: This type of binding is
with the ngModel directive. This directive is unidirectional, i.e. this binds the data flow from
supported by <input>, <select> & <textarea>. either component to view(DOM) or from the
Syntax: view(DOM) to the component. There are
<element ng-model=""> various techniques through which the data flow
can be bind from component to view or vice-
Content...
versa. If the data flow from component to
</element>
view(DOM), then this task can be accomplished
3.10.4 Data Binding with the help of String Interpolation &
Property Binding.
Angular provides a function Data Binding which
3.10.5 Controllers
helps us to have an almost real-time reflection of
the input given by the user i.e. it creates a AngularJS controllers play a significant role in
connection between Model and View. Data AngularJS applications. All the AngularJS
Binding is a way to synchronize the data application mainly relies on the controllers to
between the model and view components control the flow of data in that application.
automatically. AngularJS implements data- Basically, it controls the data of AngularJS
binding that treats the model as the single-
NOTES
source-of-truth in your application & for all the
69 | SRMIST DDE MCA Self Instructional Material
applications and the controller is a Javascript object, created by a standard
JavaScript object constructor.
The ng-controller directive defines the application controller. In AngularJS, a
controller is defined by a Javascript construction function, which is used in
AngularJS scope and also the function $scope) is defined when the controller
is defining and it returns the concatenation of the $scope.firstname and
$scope.lastname.
Syntax:
<element ng-controller="expression">
Contents...
</element>
<!DOCTYPE html>
<html>
<head>
</head>
= <span>{{Num1 * Num2}}</span>
</body>
</html>
An AngularJS application consists of following Step 2: Define AngularJS application using ng-
three important parts − app directive <div ng-app = "">
...
∙ ng-app − This directive defines and links an
</div>
AngularJS application to HTML.
Step 3: Define a model name using ng-model
∙ ng-model − This directive binds the values of directive
AngularJS application data to HTML input <p>Enter your Name: <input type = "text" ng-
controls. model = "name"></p>
∙ ng-bind − This directive binds the AngularJS Step 4: Bind the value of above model defined
Application data to HTML tags. using ng-bind directive <p>Hello <span ng-bind
= "name"></span>!</p>
Creating AngularJS Application
Executing AngularJS Application
Step 1: Load framework
Use the above-mentioned three steps in an
Being a pure JavaScript framework, it can be HTML page.
added using <Script> tag. <html>
<script
71 | SRMIST DDE MCA Self Instructional Material
src =
"https://ajax.googleapis.com/ajax/libs/angularjs/ NOTES
<head>
<title>AngularJS First Application</title>
</head>
<body>
<h1>Sample Application</h1>
<script src =
"https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/
angular.min.js"> </script>
</body>
</html>
Output
▪ PayPal
▪ Grasshopper
▪ Samsung
▪ Delta
▪ Overleaf
3.12.1 Advantages
1. MVC support
2. Code reuse
3. Plug-and-play feature
11. Focus on UX
With time, user experience (UX) has become crucial for all businesses as it
builds trust and relationships with potential customers. AngularJS enables
organizations to design SPAs that allow users to access all the information
they need on one page. It not just suits the business needs but also gives a
great user experience.
References
[1] https://www.freecodecamp.org/
[2] https://www.javatpoint.com/
[3] https://www.geeksforgeeks.org
76 SRMIST DDE MCA Self Instructional Material