SlideShare una empresa de Scribd logo
1 de 33
Introduction of ASP.NET MVC
and AngularJS
Core concepts and case study
Beginner Level
By: Mohamed Elkhodary
AGENDA
• ASP.NET MVC
• What is MVC?
• Separation of concern.
• Create a new app.
• Add a controller.
• Add a view.
• Add a model.
• AngularJS
• What is AngularJS?
• Directives.
• Downloading the libraries.
• Definitions.
• Case Study
• Using ASP.NET MVC and AngularJS in one of company’s product.
ASP.NET MVC
Introduction
MVC | What is MVC?
The ASP.NET MVC is a web application framework developed by
Microsoft, which implements the model–view–controller (MVC)
pattern.
• A model represents the classes that represent the data of the app and that
use validation logic to enforce business rules for that data. .
• A controller represents the classes that handle browser requests, retrieve
model data, and then specify view templates that return a response to the
view.
• A view accepts necessary information from the controller and renders a user
interface to display that information.
MVC | Separation of concern
• Separate the different aspects of the app (input logic, business logic,
and UI logic).
• Provide a loose coupling between these elements.
• This separation helps you manage complexity, because it enables you
to work on one aspect of the implementation at a time without
impacting the code of another.
• For example, you can work on the view code without depending on
the business logic code.
MVC | Create a new app
MVC | Create a new app
MVC | Create a new app
MVC | Create a new app
MVC | Model – View - Controller
MVC | Add a controller
MVC | Add a controller
MVC | Add a controller
When you run the app and don’t supply any URL segments, it defaults
to the “Home” controller and the “Index” method specified in the
template line highlighted below that can be find in the Startup.cs file.
MVC | Add a controller
The controller now doing the “VC” portion of MVC - that is, the view
and controller work. The controller is returning HTML directly.
MVC | Add a view
MVC | Add a view
• The Index method below uses a view template to generate an HTML
response to the browser.
• Controller methods (also known as action methods), such as the
Index method below, generally return an IActionResult (or a class
derived from ActionResult), not primitive types like string.
Controller
MVC | Add a view
View
Controller
MVC | Add a view
Displayed data “Hello from our View Template!” is hard-coded.
The MVC application has a “V” (view) and you’ve got a “C” (controller),
but how to pass dynamic data?
MVC | Passing data from the controller to the
view
Controller
View
MVC | Passing data from the controller to the
view
MVC | Controller vs View
• Controllers are responsible for providing whatever data or objects are
required in order for a view template to render a response to the
browser.
• A best practice: A view template should never perform business logic
or interact with a database directly.
• A view template should work only with the data that’s provided to it
by the controller.
• Maintaining this “separation of concerns” helps keep your code clean,
testable and more maintainable.
MVC | Add a model
• In Solution Explorer, right click the Models folder > Add > Class.
AngularJS
Introduction
AngularJS | What is AngularJS?
• AngularJS or Angular.js is an open-source web application framework
mainly maintained by Google.
• A client-side JavaScript Framework for adding interactivity to HTML.
• It aims to simplify both the development and the testing of such
applications by providing a framework for client-side model–view–
controller (MVC) architecture.
AngularJS | What is AngularJS?
How do we tell our HTML when to trigger our JavaScript?
AngularJS | What is AngularJS?
How do we tell our HTML when to trigger our AngularJS?
AngularJS | Directives
A Directive is a marker on a HTML tag that tells Angular to run or
reference some JavaScript code.
AngularJS | Downloading the libraries
https://angularjs.org/
AngularJS | Try it in Plunker!
https://embed.plnkr.co/dbCEOw/
AngularJS | Definitions
Directives
HTML annotations
that trigger
JavaScript
behaviors
Modules
Where our
application
components live
Controllers
Where we add
application
behavior behind
the DOM
Expressions
How values get
displayed within the
page
Case Study
Let’s discover how ASP.NET MVC and AngularJS can work together.
References
• http://www.asp.net/mvc
• https://angularjs.org/
Thank You

Más contenido relacionado

La actualidad más candente

Angular js tutorial slides
Angular js tutorial slidesAngular js tutorial slides
Angular js tutorial slides
samhelman
 

La actualidad más candente (20)

Angular vs React: Building modern SharePoint interfaces with SPFx
Angular vs React: Building modern SharePoint interfaces with SPFxAngular vs React: Building modern SharePoint interfaces with SPFx
Angular vs React: Building modern SharePoint interfaces with SPFx
 
Webinar MVC6
Webinar MVC6Webinar MVC6
Webinar MVC6
 
Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013
 
Angular js - 10 reasons to choose angularjs
Angular js - 10 reasons to choose angularjs Angular js - 10 reasons to choose angularjs
Angular js - 10 reasons to choose angularjs
 
Angular js tutorial slides
Angular js tutorial slidesAngular js tutorial slides
Angular js tutorial slides
 
Latest Javascript MVC & Front End Frameworks 2017
Latest Javascript MVC & Front End Frameworks 2017Latest Javascript MVC & Front End Frameworks 2017
Latest Javascript MVC & Front End Frameworks 2017
 
Javascript Frameworks Comparison - Angular, Knockout, Ember and Backbone
Javascript Frameworks Comparison - Angular, Knockout, Ember and BackboneJavascript Frameworks Comparison - Angular, Knockout, Ember and Backbone
Javascript Frameworks Comparison - Angular, Knockout, Ember and Backbone
 
Discuss About ASP.NET MVC 6 and ASP.NET MVC 5
Discuss About ASP.NET MVC 6 and ASP.NET MVC 5Discuss About ASP.NET MVC 6 and ASP.NET MVC 5
Discuss About ASP.NET MVC 6 and ASP.NET MVC 5
 
MVC 6 Introduction
MVC 6 IntroductionMVC 6 Introduction
MVC 6 Introduction
 
React or Angular and SharePoint Framework Development
React or Angular and SharePoint Framework DevelopmentReact or Angular and SharePoint Framework Development
React or Angular and SharePoint Framework Development
 
Asp.net mvc 5 course module 1 overview
Asp.net mvc 5 course   module 1 overviewAsp.net mvc 5 course   module 1 overview
Asp.net mvc 5 course module 1 overview
 
Angular 4
Angular 4Angular 4
Angular 4
 
AngularJS vs React JS vs Node JS: Which is Best For Web Development ?
AngularJS vs React JS vs Node JS: Which is Best For Web Development ?AngularJS vs React JS vs Node JS: Which is Best For Web Development ?
AngularJS vs React JS vs Node JS: Which is Best For Web Development ?
 
AngularJS is awesome
AngularJS is awesomeAngularJS is awesome
AngularJS is awesome
 
SpringPeople Introduction to Spring Framework
SpringPeople Introduction to Spring FrameworkSpringPeople Introduction to Spring Framework
SpringPeople Introduction to Spring Framework
 
Introducing ASP.NET Core 2.0
Introducing ASP.NET Core 2.0Introducing ASP.NET Core 2.0
Introducing ASP.NET Core 2.0
 
ASP.NET 5 Overview for Apex Systems
ASP.NET 5 Overview for Apex SystemsASP.NET 5 Overview for Apex Systems
ASP.NET 5 Overview for Apex Systems
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React Native
 
Modern Applications With Asp.net Core 5 and Vue JS 3
Modern Applications With Asp.net Core 5 and Vue JS 3Modern Applications With Asp.net Core 5 and Vue JS 3
Modern Applications With Asp.net Core 5 and Vue JS 3
 
Building rest services using aspnetwebapi
Building rest services using aspnetwebapiBuilding rest services using aspnetwebapi
Building rest services using aspnetwebapi
 

Destacado

Introduction to Web Architecture
Introduction to Web ArchitectureIntroduction to Web Architecture
Introduction to Web Architecture
Chamnap Chhorn
 

Destacado (8)

Client Side MVC & Angular
Client Side MVC & AngularClient Side MVC & Angular
Client Side MVC & Angular
 
Einführung in React
Einführung in ReactEinführung in React
Einführung in React
 
AngularJS 101 - Everything you need to know to get started
AngularJS 101 - Everything you need to know to get startedAngularJS 101 - Everything you need to know to get started
AngularJS 101 - Everything you need to know to get started
 
PMP Chap 7 - Project Cost Management - Part 2
PMP Chap 7 - Project Cost Management - Part 2PMP Chap 7 - Project Cost Management - Part 2
PMP Chap 7 - Project Cost Management - Part 2
 
PMPProcessGroupTasks
PMPProcessGroupTasksPMPProcessGroupTasks
PMPProcessGroupTasks
 
Introduction to Web Architecture
Introduction to Web ArchitectureIntroduction to Web Architecture
Introduction to Web Architecture
 
PMBOK-5th ed: PMP- Flashcards Part1/5
PMBOK-5th ed: PMP- Flashcards Part1/5PMBOK-5th ed: PMP- Flashcards Part1/5
PMBOK-5th ed: PMP- Flashcards Part1/5
 
PMP Chap 7 - Project Cost Management - Part 1
PMP Chap 7 - Project Cost Management - Part 1PMP Chap 7 - Project Cost Management - Part 1
PMP Chap 7 - Project Cost Management - Part 1
 

Similar a Introduction of ASP.NET MVC and AngularJS

Mvc 130330091359-phpapp01
Mvc 130330091359-phpapp01Mvc 130330091359-phpapp01
Mvc 130330091359-phpapp01
Jennie Gajjar
 

Similar a Introduction of ASP.NET MVC and AngularJS (20)

Asp.net mvc
Asp.net mvcAsp.net mvc
Asp.net mvc
 
MVC Framework
MVC FrameworkMVC Framework
MVC Framework
 
Model view controller (mvc)
Model view controller (mvc)Model view controller (mvc)
Model view controller (mvc)
 
ASP.Net | Sabin Saleem
ASP.Net | Sabin SaleemASP.Net | Sabin Saleem
ASP.Net | Sabin Saleem
 
Intoduction to Angularjs
Intoduction to AngularjsIntoduction to Angularjs
Intoduction to Angularjs
 
MVC architecture
MVC architectureMVC architecture
MVC architecture
 
Introduction to mvc architecture
Introduction to mvc architectureIntroduction to mvc architecture
Introduction to mvc architecture
 
Top 40 MVC Interview Questions and Answers | Edureka
Top 40 MVC Interview Questions and Answers | EdurekaTop 40 MVC Interview Questions and Answers | Edureka
Top 40 MVC Interview Questions and Answers | Edureka
 
Single page application 03
Single page application   03Single page application   03
Single page application 03
 
Web engineering - MVC
Web engineering - MVCWeb engineering - MVC
Web engineering - MVC
 
Mvc 130330091359-phpapp01
Mvc 130330091359-phpapp01Mvc 130330091359-phpapp01
Mvc 130330091359-phpapp01
 
MVC 4
MVC 4MVC 4
MVC 4
 
Asp 1a-aspnetmvc
Asp 1a-aspnetmvcAsp 1a-aspnetmvc
Asp 1a-aspnetmvc
 
Aspnetmvc 1
Aspnetmvc 1Aspnetmvc 1
Aspnetmvc 1
 
Technoligent providing custom ASP.NET MVC development services
Technoligent providing custom ASP.NET MVC development servicesTechnoligent providing custom ASP.NET MVC development services
Technoligent providing custom ASP.NET MVC development services
 
Mvc architecture
Mvc architectureMvc architecture
Mvc architecture
 
Angularjs overview
Angularjs  overviewAngularjs  overview
Angularjs overview
 
Sitecore mvc
Sitecore mvcSitecore mvc
Sitecore mvc
 
Very basic of asp.net mvc with c#
Very basic of asp.net mvc with c#Very basic of asp.net mvc with c#
Very basic of asp.net mvc with c#
 
Ajs ppt
Ajs pptAjs ppt
Ajs ppt
 

Último

introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Último (20)

Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
SHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationSHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions Presentation
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
 
%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 

Introduction of ASP.NET MVC and AngularJS

  • 1. Introduction of ASP.NET MVC and AngularJS Core concepts and case study Beginner Level By: Mohamed Elkhodary
  • 2. AGENDA • ASP.NET MVC • What is MVC? • Separation of concern. • Create a new app. • Add a controller. • Add a view. • Add a model. • AngularJS • What is AngularJS? • Directives. • Downloading the libraries. • Definitions. • Case Study • Using ASP.NET MVC and AngularJS in one of company’s product.
  • 4. MVC | What is MVC? The ASP.NET MVC is a web application framework developed by Microsoft, which implements the model–view–controller (MVC) pattern. • A model represents the classes that represent the data of the app and that use validation logic to enforce business rules for that data. . • A controller represents the classes that handle browser requests, retrieve model data, and then specify view templates that return a response to the view. • A view accepts necessary information from the controller and renders a user interface to display that information.
  • 5. MVC | Separation of concern • Separate the different aspects of the app (input logic, business logic, and UI logic). • Provide a loose coupling between these elements. • This separation helps you manage complexity, because it enables you to work on one aspect of the implementation at a time without impacting the code of another. • For example, you can work on the view code without depending on the business logic code.
  • 6. MVC | Create a new app
  • 7. MVC | Create a new app
  • 8. MVC | Create a new app
  • 9. MVC | Create a new app
  • 10. MVC | Model – View - Controller
  • 11. MVC | Add a controller
  • 12. MVC | Add a controller
  • 13. MVC | Add a controller When you run the app and don’t supply any URL segments, it defaults to the “Home” controller and the “Index” method specified in the template line highlighted below that can be find in the Startup.cs file.
  • 14. MVC | Add a controller The controller now doing the “VC” portion of MVC - that is, the view and controller work. The controller is returning HTML directly.
  • 15. MVC | Add a view
  • 16. MVC | Add a view • The Index method below uses a view template to generate an HTML response to the browser. • Controller methods (also known as action methods), such as the Index method below, generally return an IActionResult (or a class derived from ActionResult), not primitive types like string. Controller
  • 17. MVC | Add a view View Controller
  • 18. MVC | Add a view Displayed data “Hello from our View Template!” is hard-coded. The MVC application has a “V” (view) and you’ve got a “C” (controller), but how to pass dynamic data?
  • 19. MVC | Passing data from the controller to the view Controller View
  • 20. MVC | Passing data from the controller to the view
  • 21. MVC | Controller vs View • Controllers are responsible for providing whatever data or objects are required in order for a view template to render a response to the browser. • A best practice: A view template should never perform business logic or interact with a database directly. • A view template should work only with the data that’s provided to it by the controller. • Maintaining this “separation of concerns” helps keep your code clean, testable and more maintainable.
  • 22. MVC | Add a model • In Solution Explorer, right click the Models folder > Add > Class.
  • 24. AngularJS | What is AngularJS? • AngularJS or Angular.js is an open-source web application framework mainly maintained by Google. • A client-side JavaScript Framework for adding interactivity to HTML. • It aims to simplify both the development and the testing of such applications by providing a framework for client-side model–view– controller (MVC) architecture.
  • 25. AngularJS | What is AngularJS? How do we tell our HTML when to trigger our JavaScript?
  • 26. AngularJS | What is AngularJS? How do we tell our HTML when to trigger our AngularJS?
  • 27. AngularJS | Directives A Directive is a marker on a HTML tag that tells Angular to run or reference some JavaScript code.
  • 28. AngularJS | Downloading the libraries https://angularjs.org/
  • 29. AngularJS | Try it in Plunker! https://embed.plnkr.co/dbCEOw/
  • 30. AngularJS | Definitions Directives HTML annotations that trigger JavaScript behaviors Modules Where our application components live Controllers Where we add application behavior behind the DOM Expressions How values get displayed within the page
  • 31. Case Study Let’s discover how ASP.NET MVC and AngularJS can work together.

Notas del editor

  1. Let’s check this example. The ViewData dictionary object contains data that will be passed to the view.
  2. Let’s check this example. The ViewData dictionary object contains data that will be passed to the view.