SlideShare a Scribd company logo
Anuradha Bandara
How Web Page Creates?
 HTML (Structure)
 Css (Style)
 Javascript (Behavior)
◦ HTML tags create objects.
 In other words……Document Object Model(DOM)
◦ <SCRIPT></SCRIPT>
 Once page found this tag – Start download the javascript.
◦ JavaScript lets you manipulate the DOM.
◦ Css – do the styles.
What is DOM?
 The Document Object Model (DOM) is an application programming
interface (API) for valid HTML and well-formed XML documents. It
defines the logical structure of documents and the way a document
is accessed and manipulated.
DOM Structure
DOM Structure
What is Angularjs?
 A JavaScript framework for creating
dynamic web applications
 Open Source
◦ GitHub:
https://github.com/angular/angular.js
◦ MIT License
 Uses jQuery
◦ jQuery 1.7.1 or above
◦ jQLite
MVC or MVW….
 Model
◦ The data
 View
◦ The interface
◦ How the data is presented to the user
 Whatever
(Controller/Services/Directives/Filters)
◦ The behavior
◦ Modifying / updating the models
How Angularjs works?
 bindJQuery() : Either one of jQuery or jqLite is bound to angular.
 angularInit(document, bootstrap) : method which checks for ng-app module
 bootstrap(element) : method which is invoked once an ng-app module is found
◦ Invoke createInjector() method which returns dependency injector
◦ The dependency injector invokes the compilation and linking process with some of the following
key parameters:
 Scope object – Reference to rootScope
 Reference to element with ng-app
 Compile service
 Reference to dependency injector
How Angularjs works? Cont…
 compile(element): bind events to the element
 compile(element)(scope): bind element to the scope
◦ At this phase compiler will look for every directive and creates the watchers ($watch) that are
needed.
 scope.$apply(function{}): Finally, the $apply method is invoked on
the scope object
As a result of execution of $apply
method, the view appears……
How Angularjs works? Cont…
Reusable components with
directives….
 A directive is an extension of the HTML vocabulary that allows us to
create new behaviours. This technology lets the developers create
reusable components that can be used within the whole application.
 The directive can be applied as an
◦ Attribute
◦ Element
◦ Class
◦ Comment
 we can use ng-model, ng:model, ng_model,data-ng-model,
and x-ng-model in the HTML markup.
AngularJS built-in directives...
 ngApp - defines the root of an AngularJS application
 ngController - attach any controller to the view
◦ Nested Controllers
 ngBind – act as same as {{expression}}
 ngBindHtml – bind plain html
AngularJS built-in directives...
 ngRepeat - iterate over arrays and objects.
 ngModel - attaches the element to a property in
the scope
 ngClick – bind any custom behavior to the click
event of the element
 ngDisable – disable elements based on the
Boolean value of an expression.
 ngClass – dynamically apply a class to an element
 ngOptions – create the options of a select element
 ngStyle – apply the dynamic style configuration
demand
AngularJS built-in directives...
 ngShow/ngHide – apply visibility of an element
based on its
display property.
 ngIf - prevents the rendering of an element in our template
 ngClick – bind any custom behavior to the click
event of the element
 ngInclude – include other external HTML fragments in to
pages
Create own Directory
Directive properties
Dependency Injection
and Services…
 Services
◦ Use to isolating the business logic in the application
 Lazily instantiated – Angular only instantiates a service when an application component depends on it.
 Singletons – Each component dependent on a service gets a reference to the single instance generated
by the service factory.
 No UI
 Dependency Injection
◦ A software design pattern that deals with how components get hold of
their dependencies.
◦ eg :
Dependency Injection
and Services…
 Custom Services
◦ We can define our own custom services in different ways in angular js app
and use them wherever required
 Service()
 Factory()
 Provider()
Dependency Injection
and Services…
 Creating services with the factory
◦ You give angular a function
◦ Angular create an object
◦ add properties to it
◦ return that same object
Dependency Injection
and Services…
 Creating services with the Service
◦ You give angular a function
◦ Angular will instantiated with the ‘new’ keyword
◦ add properties to “this”
◦ return “this”
Dependency Injection
and Services…
 Creating services with the Provider
◦ You give angular a function
◦ angular will call its $get function
◦ return value from the $get function
Data handling…
 Expressions
 Filters
 Form validations
Data handling…
 Expressions
◦ An expression is a simple piece of code
that will be evaluated by the framework
and can be written between double curly
brackets
eg : {{car.plate}}
Data handling…
 Filters
◦ perfect solution to easily perform any data manipulation.
 Eg :
 {{expression | filter}}
 {{expression | filter1 | filter2}}
◦ Currency
 {{ 10 | currency}} => $10.00 (take locale currency)
 {{ 10 | currency:'R$'}} => R$ 10.00
◦ Date
 {{ car.entrance | date }} => Dec 10, 2014
 {{ car.entrance | date:'MMMM dd/MM/yyyy HH:mm:ss' }} =>
December 10/12/2013 21:42:10.
Data handling…
 Filters
◦ Filter
◦ Json
 {{ car | json }} =>
Data handling…
 Filters
◦ limitTo – limit size to 10
 {{ expression | limitTo:10 }}
◦ Lowercase – convert to lowercase
 {{ expression | lowercase }}
◦ Number – limit two decimal places
 {{ 10 | number:2 }} => 10.00
◦ Orderby – orderby String/Array
 {{ expression | orderBy:predicate:reverse }}
Data handling…
 Creating custom filters
Data handling…
 Form validations
 $pristine =>form is not modified
 $dirty => form is modified
Data handling…
 Form validations
 $error => It accumulates the detailed list of
everything that happens with the form
Data Binding – Two way
 Data-binding in Angular apps is the automatic synchronization of
data between the model and view components.
 The view is a projection of the model at all times. When the model
changes, the view reflects the change, and vice versa.
How Data binding works?
Exactly what happen when you do event on a
browser….
 browser is waiting for events / user interactions.
 click on a button or write into an input.
 fire browser event loop.
 browser will make the appropriate changes in the DOM
How Data binding works?
How angulerjs reacts?
 When you create ui component using directive
 Add $watch to watch list call $digest
 After fire event loop $digest loop will be fired.
 It checks values are updated.
 Call $apply()
As a result of execution of $apply method, the view
updated……
Scope….
 scope is an object that refers to the application model
 Scopes are arranged in hierarchical structure which mimic the DOM
structure of the application
 Create connection between view & controller
$rootscope / $parent / $scope
You give angular a functionYou give angular a function
Exercise..
 Writing own directory…
◦ Replace label with dropdown when click
the edit button.
◦ When user change the dropdown
automatically update the model.
Thank you….

More Related Content

What's hot

Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
Jussi Pohjolainen
 
AngularJS in 60ish Minutes
AngularJS in 60ish MinutesAngularJS in 60ish Minutes
AngularJS in 60ish Minutes
Dan Wahlin
 
Advanced Tips & Tricks for using Angular JS
Advanced Tips & Tricks for using Angular JSAdvanced Tips & Tricks for using Angular JS
Advanced Tips & Tricks for using Angular JS
Simon Guest
 
AngularJS Basics with Example
AngularJS Basics with ExampleAngularJS Basics with Example
AngularJS Basics with Example
Sergey Bolshchikov
 
Angular JS - Introduction
Angular JS - IntroductionAngular JS - Introduction
Angular JS - Introduction
Sagar Acharya
 
AngularJS intro
AngularJS introAngularJS intro
AngularJS intro
dizabl
 
AngularJS Architecture
AngularJS ArchitectureAngularJS Architecture
AngularJS Architecture
Eyal Vardi
 
AngularJS for designers and developers
AngularJS for designers and developersAngularJS for designers and developers
AngularJS for designers and developersKai Koenig
 
Dynamic Application Development by NodeJS ,AngularJS with OrientDB
Dynamic Application Development by NodeJS ,AngularJS with OrientDBDynamic Application Development by NodeJS ,AngularJS with OrientDB
Dynamic Application Development by NodeJS ,AngularJS with OrientDB
Apaichon Punopas
 
Top 10 Mistakes AngularJS Developers Make
Top 10 Mistakes AngularJS Developers MakeTop 10 Mistakes AngularJS Developers Make
Top 10 Mistakes AngularJS Developers Make
Mark Meyer
 
Workshop 12: AngularJS Parte I
Workshop 12: AngularJS Parte IWorkshop 12: AngularJS Parte I
Workshop 12: AngularJS Parte I
Visual Engineering
 
AngularJS application architecture
AngularJS application architectureAngularJS application architecture
AngularJS application architecture
Gabriele Falace
 
AngularJS Internal
AngularJS InternalAngularJS Internal
AngularJS Internal
Eyal Vardi
 
Angularjs Anti-patterns
Angularjs Anti-patternsAngularjs Anti-patterns
Angularjs Anti-patterns
Steven Lambert
 
AngularJS Basics and Best Practices - CC FE &UX
AngularJS Basics and Best Practices - CC FE &UXAngularJS Basics and Best Practices - CC FE &UX
AngularJS Basics and Best Practices - CC FE &UX
JWORKS powered by Ordina
 
AngularJS Best Practices
AngularJS Best PracticesAngularJS Best Practices
AngularJS Best Practices
Narek Mamikonyan
 
Why angular js Framework
Why angular js Framework Why angular js Framework
Why angular js Framework
Sakthi Bro
 

What's hot (20)

Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
 
Introduction to Angularjs
Introduction to AngularjsIntroduction to Angularjs
Introduction to Angularjs
 
AngularJS in 60ish Minutes
AngularJS in 60ish MinutesAngularJS in 60ish Minutes
AngularJS in 60ish Minutes
 
Advanced Tips & Tricks for using Angular JS
Advanced Tips & Tricks for using Angular JSAdvanced Tips & Tricks for using Angular JS
Advanced Tips & Tricks for using Angular JS
 
AngularJS Basics with Example
AngularJS Basics with ExampleAngularJS Basics with Example
AngularJS Basics with Example
 
Angular JS - Introduction
Angular JS - IntroductionAngular JS - Introduction
Angular JS - Introduction
 
Angular js
Angular jsAngular js
Angular js
 
AngularJS intro
AngularJS introAngularJS intro
AngularJS intro
 
AngularJS Architecture
AngularJS ArchitectureAngularJS Architecture
AngularJS Architecture
 
AngularJS for designers and developers
AngularJS for designers and developersAngularJS for designers and developers
AngularJS for designers and developers
 
Dynamic Application Development by NodeJS ,AngularJS with OrientDB
Dynamic Application Development by NodeJS ,AngularJS with OrientDBDynamic Application Development by NodeJS ,AngularJS with OrientDB
Dynamic Application Development by NodeJS ,AngularJS with OrientDB
 
Angularjs
AngularjsAngularjs
Angularjs
 
Top 10 Mistakes AngularJS Developers Make
Top 10 Mistakes AngularJS Developers MakeTop 10 Mistakes AngularJS Developers Make
Top 10 Mistakes AngularJS Developers Make
 
Workshop 12: AngularJS Parte I
Workshop 12: AngularJS Parte IWorkshop 12: AngularJS Parte I
Workshop 12: AngularJS Parte I
 
AngularJS application architecture
AngularJS application architectureAngularJS application architecture
AngularJS application architecture
 
AngularJS Internal
AngularJS InternalAngularJS Internal
AngularJS Internal
 
Angularjs Anti-patterns
Angularjs Anti-patternsAngularjs Anti-patterns
Angularjs Anti-patterns
 
AngularJS Basics and Best Practices - CC FE &UX
AngularJS Basics and Best Practices - CC FE &UXAngularJS Basics and Best Practices - CC FE &UX
AngularJS Basics and Best Practices - CC FE &UX
 
AngularJS Best Practices
AngularJS Best PracticesAngularJS Best Practices
AngularJS Best Practices
 
Why angular js Framework
Why angular js Framework Why angular js Framework
Why angular js Framework
 

Similar to Angularjs Basics

Intoduction to Angularjs
Intoduction to AngularjsIntoduction to Angularjs
Intoduction to Angularjs
Gaurav Agrawal
 
Introduction to Angularjs : kishan kumar
Introduction to Angularjs : kishan kumarIntroduction to Angularjs : kishan kumar
Introduction to Angularjs : kishan kumar
Appfinz Technologies
 
AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014
Ran Wahle
 
Angular js
Angular jsAngular js
Introduction to single page application with angular js
Introduction to single page application with angular jsIntroduction to single page application with angular js
Introduction to single page application with angular js
Mindfire Solutions
 
Learning AngularJS - Complete coverage of AngularJS features and concepts
Learning AngularJS  - Complete coverage of AngularJS features and conceptsLearning AngularJS  - Complete coverage of AngularJS features and concepts
Learning AngularJS - Complete coverage of AngularJS features and concepts
Suresh Patidar
 
angularJs Workshop
angularJs WorkshopangularJs Workshop
angularJs Workshop
Ran Wahle
 
Angular js slides
Angular js slidesAngular js slides
Angular js slides
Amr Abd El Latief
 
Understanding angular js
Understanding angular jsUnderstanding angular js
Understanding angular js
Aayush Shrestha
 
Angular Js Get Started - Complete Course
Angular Js Get Started - Complete CourseAngular Js Get Started - Complete Course
Angular Js Get Started - Complete Course
EPAM Systems
 
Angular workshop - Full Development Guide
Angular workshop - Full Development GuideAngular workshop - Full Development Guide
Angular workshop - Full Development Guide
Nitin Giri
 
introduction to Angularjs basics
introduction to Angularjs basicsintroduction to Angularjs basics
introduction to Angularjs basics
Ravindra K
 
AngularJs (1.x) Presentation
AngularJs (1.x) PresentationAngularJs (1.x) Presentation
AngularJs (1.x) Presentation
Raghubir Singh
 
GDG Atlanta - Angular.js Demo and Workshop
GDG Atlanta - Angular.js Demo and WorkshopGDG Atlanta - Angular.js Demo and Workshop
GDG Atlanta - Angular.js Demo and Workshop
Drew Morris
 
Angular js
Angular jsAngular js
Angular js
Baldeep Sohal
 
AngularJS
AngularJSAngularJS
Angular js workshop
Angular js workshopAngular js workshop
Angular js workshop
Rolands Krumbergs
 
AngularJS By Vipin
AngularJS By VipinAngularJS By Vipin
AngularJS By Vipin
Vipin Mundayad
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
Anass90
 
Angular js
Angular jsAngular js

Similar to Angularjs Basics (20)

Intoduction to Angularjs
Intoduction to AngularjsIntoduction to Angularjs
Intoduction to Angularjs
 
Introduction to Angularjs : kishan kumar
Introduction to Angularjs : kishan kumarIntroduction to Angularjs : kishan kumar
Introduction to Angularjs : kishan kumar
 
AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014
 
Angular js
Angular jsAngular js
Angular js
 
Introduction to single page application with angular js
Introduction to single page application with angular jsIntroduction to single page application with angular js
Introduction to single page application with angular js
 
Learning AngularJS - Complete coverage of AngularJS features and concepts
Learning AngularJS  - Complete coverage of AngularJS features and conceptsLearning AngularJS  - Complete coverage of AngularJS features and concepts
Learning AngularJS - Complete coverage of AngularJS features and concepts
 
angularJs Workshop
angularJs WorkshopangularJs Workshop
angularJs Workshop
 
Angular js slides
Angular js slidesAngular js slides
Angular js slides
 
Understanding angular js
Understanding angular jsUnderstanding angular js
Understanding angular js
 
Angular Js Get Started - Complete Course
Angular Js Get Started - Complete CourseAngular Js Get Started - Complete Course
Angular Js Get Started - Complete Course
 
Angular workshop - Full Development Guide
Angular workshop - Full Development GuideAngular workshop - Full Development Guide
Angular workshop - Full Development Guide
 
introduction to Angularjs basics
introduction to Angularjs basicsintroduction to Angularjs basics
introduction to Angularjs basics
 
AngularJs (1.x) Presentation
AngularJs (1.x) PresentationAngularJs (1.x) Presentation
AngularJs (1.x) Presentation
 
GDG Atlanta - Angular.js Demo and Workshop
GDG Atlanta - Angular.js Demo and WorkshopGDG Atlanta - Angular.js Demo and Workshop
GDG Atlanta - Angular.js Demo and Workshop
 
Angular js
Angular jsAngular js
Angular js
 
AngularJS
AngularJSAngularJS
AngularJS
 
Angular js workshop
Angular js workshopAngular js workshop
Angular js workshop
 
AngularJS By Vipin
AngularJS By VipinAngularJS By Vipin
AngularJS By Vipin
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
 
Angular js
Angular jsAngular js
Angular js
 

Recently uploaded

Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
chanes7
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 

Recently uploaded (20)

Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 

Angularjs Basics

  • 2. How Web Page Creates?  HTML (Structure)  Css (Style)  Javascript (Behavior) ◦ HTML tags create objects.  In other words……Document Object Model(DOM) ◦ <SCRIPT></SCRIPT>  Once page found this tag – Start download the javascript. ◦ JavaScript lets you manipulate the DOM. ◦ Css – do the styles.
  • 3. What is DOM?  The Document Object Model (DOM) is an application programming interface (API) for valid HTML and well-formed XML documents. It defines the logical structure of documents and the way a document is accessed and manipulated.
  • 6. What is Angularjs?  A JavaScript framework for creating dynamic web applications  Open Source ◦ GitHub: https://github.com/angular/angular.js ◦ MIT License  Uses jQuery ◦ jQuery 1.7.1 or above ◦ jQLite
  • 7. MVC or MVW….  Model ◦ The data  View ◦ The interface ◦ How the data is presented to the user  Whatever (Controller/Services/Directives/Filters) ◦ The behavior ◦ Modifying / updating the models
  • 8. How Angularjs works?  bindJQuery() : Either one of jQuery or jqLite is bound to angular.  angularInit(document, bootstrap) : method which checks for ng-app module  bootstrap(element) : method which is invoked once an ng-app module is found ◦ Invoke createInjector() method which returns dependency injector ◦ The dependency injector invokes the compilation and linking process with some of the following key parameters:  Scope object – Reference to rootScope  Reference to element with ng-app  Compile service  Reference to dependency injector
  • 9. How Angularjs works? Cont…  compile(element): bind events to the element  compile(element)(scope): bind element to the scope ◦ At this phase compiler will look for every directive and creates the watchers ($watch) that are needed.  scope.$apply(function{}): Finally, the $apply method is invoked on the scope object As a result of execution of $apply method, the view appears……
  • 11. Reusable components with directives….  A directive is an extension of the HTML vocabulary that allows us to create new behaviours. This technology lets the developers create reusable components that can be used within the whole application.  The directive can be applied as an ◦ Attribute ◦ Element ◦ Class ◦ Comment  we can use ng-model, ng:model, ng_model,data-ng-model, and x-ng-model in the HTML markup.
  • 12. AngularJS built-in directives...  ngApp - defines the root of an AngularJS application  ngController - attach any controller to the view ◦ Nested Controllers  ngBind – act as same as {{expression}}  ngBindHtml – bind plain html
  • 13. AngularJS built-in directives...  ngRepeat - iterate over arrays and objects.  ngModel - attaches the element to a property in the scope  ngClick – bind any custom behavior to the click event of the element  ngDisable – disable elements based on the Boolean value of an expression.  ngClass – dynamically apply a class to an element  ngOptions – create the options of a select element  ngStyle – apply the dynamic style configuration demand
  • 14. AngularJS built-in directives...  ngShow/ngHide – apply visibility of an element based on its display property.  ngIf - prevents the rendering of an element in our template  ngClick – bind any custom behavior to the click event of the element  ngInclude – include other external HTML fragments in to pages
  • 16. Dependency Injection and Services…  Services ◦ Use to isolating the business logic in the application  Lazily instantiated – Angular only instantiates a service when an application component depends on it.  Singletons – Each component dependent on a service gets a reference to the single instance generated by the service factory.  No UI  Dependency Injection ◦ A software design pattern that deals with how components get hold of their dependencies. ◦ eg :
  • 17. Dependency Injection and Services…  Custom Services ◦ We can define our own custom services in different ways in angular js app and use them wherever required  Service()  Factory()  Provider()
  • 18. Dependency Injection and Services…  Creating services with the factory ◦ You give angular a function ◦ Angular create an object ◦ add properties to it ◦ return that same object
  • 19. Dependency Injection and Services…  Creating services with the Service ◦ You give angular a function ◦ Angular will instantiated with the ‘new’ keyword ◦ add properties to “this” ◦ return “this”
  • 20. Dependency Injection and Services…  Creating services with the Provider ◦ You give angular a function ◦ angular will call its $get function ◦ return value from the $get function
  • 21. Data handling…  Expressions  Filters  Form validations
  • 22. Data handling…  Expressions ◦ An expression is a simple piece of code that will be evaluated by the framework and can be written between double curly brackets eg : {{car.plate}}
  • 23. Data handling…  Filters ◦ perfect solution to easily perform any data manipulation.  Eg :  {{expression | filter}}  {{expression | filter1 | filter2}} ◦ Currency  {{ 10 | currency}} => $10.00 (take locale currency)  {{ 10 | currency:'R$'}} => R$ 10.00 ◦ Date  {{ car.entrance | date }} => Dec 10, 2014  {{ car.entrance | date:'MMMM dd/MM/yyyy HH:mm:ss' }} => December 10/12/2013 21:42:10.
  • 24. Data handling…  Filters ◦ Filter ◦ Json  {{ car | json }} =>
  • 25. Data handling…  Filters ◦ limitTo – limit size to 10  {{ expression | limitTo:10 }} ◦ Lowercase – convert to lowercase  {{ expression | lowercase }} ◦ Number – limit two decimal places  {{ 10 | number:2 }} => 10.00 ◦ Orderby – orderby String/Array  {{ expression | orderBy:predicate:reverse }}
  • 27. Data handling…  Form validations  $pristine =>form is not modified  $dirty => form is modified
  • 28. Data handling…  Form validations  $error => It accumulates the detailed list of everything that happens with the form
  • 29. Data Binding – Two way  Data-binding in Angular apps is the automatic synchronization of data between the model and view components.  The view is a projection of the model at all times. When the model changes, the view reflects the change, and vice versa.
  • 30. How Data binding works? Exactly what happen when you do event on a browser….  browser is waiting for events / user interactions.  click on a button or write into an input.  fire browser event loop.  browser will make the appropriate changes in the DOM
  • 31. How Data binding works? How angulerjs reacts?  When you create ui component using directive  Add $watch to watch list call $digest  After fire event loop $digest loop will be fired.  It checks values are updated.  Call $apply() As a result of execution of $apply method, the view updated……
  • 32. Scope….  scope is an object that refers to the application model  Scopes are arranged in hierarchical structure which mimic the DOM structure of the application  Create connection between view & controller
  • 33. $rootscope / $parent / $scope You give angular a functionYou give angular a function
  • 34. Exercise..  Writing own directory… ◦ Replace label with dropdown when click the edit button. ◦ When user change the dropdown automatically update the model.

Editor's Notes

  1. Use multiple points, if necessary.
  2. Use brief bullets and discuss details verbally.