SlideShare a Scribd company logo
1 of 19
Download to read offline
Patterns Are Good For Managers 
Presented by Michael Cooper, Senior Consultant
Not all of your devscan be like him. 
Without a Superman, you need: 
•Team Productivity 
•On Boarding 
•Standardized Code & Patterns 
•Code Documentation 
•Test Coverage 
•Quality 
www.agilethought.com 2 
http://moviepilot.com/posts/2014/07/04/those-batman-v-superman-rumors-faked-by- warner-bros-1673661?lt_source=external,manual
These require a disciplined approach. 
www.agilethought.com 3
Making Swim Lanes … Your devsknow MVC 
.NET MVC, Java Spring, around since 1970s 
www.agilethought.com 4
MVC encourages SOLID code. 
www.agilethought.com 5 
Models 
Views 
Controllers 
ServiceLayer 
MVC 
Model classes 
View templates, 
Html Helpers 
MVC Razor code 
Controller 
Service Layer code 
Angular 
Model factory classes 
View templates 
Directives 
Moustache code 
Controllers 
Services
The pattern allows us to have many people working on the same project. 
www.agilethought.com 6 
Dev A 
DevsB&C 
DevsB&C 
Dev D 
And new-to-Angular devsneed to only learn one area / pattern … allowing them to be productive within one week. 
Models 
Views 
Controllers 
ServiceLayer
The pattern allows our test patterns to be standardized, giving us high coverage. 
www.agilethought.com 7 
Model Unit Tests 
Functional Tests 
Controller Unit Tests 
Service Unit Tests 
Integration Tests 
Karma/Jasmine 
Protractor, Frisby 
Models 
Views 
Controllers 
ServiceLayer
An eco-system to support the Angular pattern. 
•Project template 
•Automated test setup 
•Live templates (Intellij) that build models, controllers, services and their tests 
•Lots of examples 
•Proof it works! 
•Recently completed project: 83% UI code coverage 
www.agilethought.com 8
Code Samples –MVC Angular 
www.agilethought.com 9
Named Spaced Modules 
www.agilethought.com 10
Templates, Partial Views 
www.agilethought.com 11
Controller 
www.agilethought.com 12 
.NET MVC 
Angular 
public classHomeController: Controller{ 
public ActionResultAbout() 
{ 
ViewBag[“name"] = “Dolly"; 
return View(); 
} 
} 
[HttpPost] 
public ActionResultAbout(form){ 
//something 
} 
.config(function config( $stateProvider) { 
$stateProvider.state( 'about', { 
url: '/about', 
views: { 
"main": { 
controller: HomeAboutController', 
templateUrl: 'about/about.tpl.html' 
} 
}) 
.controller(‘HomeAboutController', 
function HomeAboutController( $scope ) { 
$scope.name = ‘Dolly’; 
$state.go(‘about’); 
$scope.respond= function(){ //something } ; 
});
HTML Helpers/Directives 
www.agilethought.com 13 
.NET MVC 
Angular 
public static class HtmlHelperExtensions{ public static MvcHtmlStringCustomTextBox(this 
HtmlHelperhtmlHelper, 
string name, string value) { varbuilder = new TagBuilder(“input”); builder.MergeAttribute(“type”, “text”); builder.MergeAttribute(“name”, name); builder.MergeAttribute(“value”, value); return MvcHtmlString 
.Create(builder.ToString( 
TagRenderMode.SelfClosing)); } } 
.directive(“CustomTextBox”, function(){ 
return { 
template:‘<input type=“text” name={{name}} 
value={{value}} />’, 
restrict: ‘E’, 
scope: { 
name: ‘=‘, 
value: ‘=‘ 
} 
} 
}); 
use:@Html.CustomTextBox(“custom_txtbox”,”Custom Helper Method”) 
use:<custom-text-box name=“custom_txtbox” 
value=“Custom Helper Method”/>
Models 
www.agilethought.com 14 
.NET MVC 
Angular 
public class Animal{ publicAnimal(); 
public string name {get;set;} 
public void Run(speed){ 
// do something 
} } 
.factory(“Animal”, function(){ 
varAnimal= function(){ 
this.name = ‘’; 
} 
Animal.prototype.Run= function(){ 
// do something 
} 
return Animal; 
}); 
use: 
varhorse= new Animal(); 
horse.name = “George”; 
horse.Run(); 
use: 
varhorse= new Animal(); 
horse.name = ‘George’; 
horse.Run();
Services Persistence 
www.agilethought.com 15 
.NET MVC 
Angular 
public staticclass StoreAnimals{ private AnimalStorebarn; 
public void Save(Animal animal){ 
barn.Animals.add(animal); 
} } 
.service(“StoreAnimals”, function($http){ 
varsave = function(animal){ 
return $http.POST( 
AnimalStore, 
angular.toJSON(animal)); 
} 
return:{ 
save: save 
} 
}); 
use: 
varhorse= new Animal(); 
horse.name = “George”; 
StoreAnimals.Save(horse); 
use: 
varhorse= new Animal(); 
horse.name = ‘George’; 
StoreAnimals.save(horse).promise.then(function(){ 
//next thing 
});
Dependency Injection 
www.agilethought.com 16 
.NET MVC 
Angular 
public staticclass StoreAnimals{ 
vardb; publicStoreAnimals(db){ 
this.db= db 
} 
public void Save(Animalanimal){ 
db.Save(animal); 
} } 
angular.module(‘myApp.store’, [ 
‘myApp.database’]) 
.service(“StoreAnimals”, function(db){ 
varsave = function(animal){ 
return db.Save(animal); 
} 
return:{ 
save: save 
} 
});
Code Documentation 
www.agilethought.com 17 
.NET MVC 
Angular 
public staticclass StoreAnimals{ 
vardb; 
publicStoreAnimals(db){ 
this.db= db 
} 
/// <summary> 
/// Stores an animal 
/// </summary> 
/// <paramname=“animal">the one to 
/// persist</param> 
/// <returns></returns> 
public void Save(Animalanimal){ 
db.Save(animal); 
} } 
angular.module(‘myApp.store’, [ 
‘myApp.database’]) 
.service(“StoreAnimals”, function(db){ 
/** 
* @method Save -Stores an animal 
* @param{Animal}animal –the one to persist 
*/ 
varsave = function(animal){ 
return db.Save(animal); 
} 
return:{ 
save: save 
} 
});
Visit our library of free webinar videos! 
Previous Webinars: 
•Azure + Visual Studio Online: How to build, test, deploy and monitor seamlessly 
•6 Steps To Achieving Predictable Release Management With Visual Studio 2013 
•How To Create High Value Development Teams 
•5 TFS Features That Will Dramatically Improve Your Team's Performance 
18
About Michael 
19 
Mike Cooper spent much of his career in software sales, development and general management, with large firms like Reuters and Pitney Bowes, and a series of start-ups. His true love is making great software, and he has built software for television, finance, construction and government, and co-founded a number of veteran–owned businesses.He is a consultant at AgileThought, specializing in AngularJS. 
Thank You 
@mbcoop 
Questions about AngularJS? Email me at Michael.Cooper@agilethought.com 
linkedin.com/in/michaelcooper

More Related Content

What's hot

Backbone.js and friends
Backbone.js and friendsBackbone.js and friends
Backbone.js and friends
Good Robot
 

What's hot (20)

AngularJS Framework
AngularJS FrameworkAngularJS Framework
AngularJS Framework
 
AngularJS Internal
AngularJS InternalAngularJS Internal
AngularJS Internal
 
Angularjs Performance
Angularjs PerformanceAngularjs Performance
Angularjs Performance
 
Intro to Angular.JS Directives
Intro to Angular.JS DirectivesIntro to Angular.JS Directives
Intro to Angular.JS Directives
 
Why angular js Framework
Why angular js Framework Why angular js Framework
Why angular js Framework
 
AngularJs
AngularJsAngularJs
AngularJs
 
AngularJS Basics with Example
AngularJS Basics with ExampleAngularJS Basics with Example
AngularJS Basics with Example
 
GDayX - Advanced Angular.JS
GDayX - Advanced Angular.JSGDayX - Advanced Angular.JS
GDayX - Advanced Angular.JS
 
Workshop 14: AngularJS Parte III
Workshop 14: AngularJS Parte IIIWorkshop 14: AngularJS Parte III
Workshop 14: AngularJS Parte III
 
Building a Startup Stack with AngularJS
Building a Startup Stack with AngularJSBuilding a Startup Stack with AngularJS
Building a Startup Stack with AngularJS
 
AngularJs Crash Course
AngularJs Crash CourseAngularJs Crash Course
AngularJs Crash Course
 
AngularJS with TypeScript and Windows Azure Mobile Services
AngularJS with TypeScript and Windows Azure Mobile ServicesAngularJS with TypeScript and Windows Azure Mobile Services
AngularJS with TypeScript and Windows Azure Mobile Services
 
Ember.js - A JavaScript framework for creating ambitious web applications
Ember.js - A JavaScript framework for creating ambitious web applications  Ember.js - A JavaScript framework for creating ambitious web applications
Ember.js - A JavaScript framework for creating ambitious web applications
 
Building scalable applications with angular js
Building scalable applications with angular jsBuilding scalable applications with angular js
Building scalable applications with angular js
 
Top 10 Mistakes AngularJS Developers Make
Top 10 Mistakes AngularJS Developers MakeTop 10 Mistakes AngularJS Developers Make
Top 10 Mistakes AngularJS Developers Make
 
Angularjs Anti-patterns
Angularjs Anti-patternsAngularjs Anti-patterns
Angularjs Anti-patterns
 
How routing works in angular js
How routing works in angular jsHow routing works in angular js
How routing works in angular js
 
Backbone.js and friends
Backbone.js and friendsBackbone.js and friends
Backbone.js and friends
 
Workshop 12: AngularJS Parte I
Workshop 12: AngularJS Parte IWorkshop 12: AngularJS Parte I
Workshop 12: AngularJS Parte I
 
Introduction to AJAX In WordPress
Introduction to AJAX In WordPressIntroduction to AJAX In WordPress
Introduction to AJAX In WordPress
 

Viewers also liked

Rethinking Mobile with Ionic
Rethinking Mobile with IonicRethinking Mobile with Ionic
Rethinking Mobile with Ionic
Mike Hartington
 

Viewers also liked (13)

Angular2 for Beginners
Angular2 for BeginnersAngular2 for Beginners
Angular2 for Beginners
 
Rethinking Mobile with Ionic
Rethinking Mobile with IonicRethinking Mobile with Ionic
Rethinking Mobile with Ionic
 
Native vs. Hybrid Applications
Native vs. Hybrid ApplicationsNative vs. Hybrid Applications
Native vs. Hybrid Applications
 
Cocoapods and Most common used library in Swift
Cocoapods and Most common used library in SwiftCocoapods and Most common used library in Swift
Cocoapods and Most common used library in Swift
 
Ionic
IonicIonic
Ionic
 
Cross platform dotnet development using dotnet core
Cross platform dotnet development using dotnet coreCross platform dotnet development using dotnet core
Cross platform dotnet development using dotnet core
 
Creating mobile apps - an introduction to Ionic (Engage 2016)
Creating mobile apps - an introduction to Ionic (Engage 2016)Creating mobile apps - an introduction to Ionic (Engage 2016)
Creating mobile apps - an introduction to Ionic (Engage 2016)
 
Rapid mobile app development using Ionic framework
Rapid mobile app development using Ionic frameworkRapid mobile app development using Ionic framework
Rapid mobile app development using Ionic framework
 
Hybrid app development with ionic
Hybrid app development with ionicHybrid app development with ionic
Hybrid app development with ionic
 
Ionic 2: Mobile apps with the Web
Ionic 2: Mobile apps with the WebIonic 2: Mobile apps with the Web
Ionic 2: Mobile apps with the Web
 
Ionic framework one day training
Ionic framework one day trainingIonic framework one day training
Ionic framework one day training
 
Hybrid Apps with Angular & Ionic Framework
Hybrid Apps with Angular & Ionic FrameworkHybrid Apps with Angular & Ionic Framework
Hybrid Apps with Angular & Ionic Framework
 
Ionic adventures - Hybrid Mobile App Development rocks
Ionic adventures - Hybrid Mobile App Development rocksIonic adventures - Hybrid Mobile App Development rocks
Ionic adventures - Hybrid Mobile App Development rocks
 

Similar to Patterns Are Good For Managers

WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...
Fabio Franzini
 

Similar to Patterns Are Good For Managers (20)

Intro to Laravel 4
Intro to Laravel 4Intro to Laravel 4
Intro to Laravel 4
 
The Rails Way
The Rails WayThe Rails Way
The Rails Way
 
AngularJS Basic Training
AngularJS Basic TrainingAngularJS Basic Training
AngularJS Basic Training
 
Viking academy backbone.js
Viking academy  backbone.jsViking academy  backbone.js
Viking academy backbone.js
 
20141002 delapsley-socalangularjs-final
20141002 delapsley-socalangularjs-final20141002 delapsley-socalangularjs-final
20141002 delapsley-socalangularjs-final
 
Basics of AngularJS
Basics of AngularJSBasics of AngularJS
Basics of AngularJS
 
PHP MVC
PHP MVCPHP MVC
PHP MVC
 
Modular Test-driven SPAs with Spring and AngularJS
Modular Test-driven SPAs with Spring and AngularJSModular Test-driven SPAs with Spring and AngularJS
Modular Test-driven SPAs with Spring and AngularJS
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...
 
Yii Introduction
Yii IntroductionYii Introduction
Yii Introduction
 
AngularJs-training
AngularJs-trainingAngularJs-training
AngularJs-training
 
Introduction to AngularJS For WordPress Developers
Introduction to AngularJS For WordPress DevelopersIntroduction to AngularJS For WordPress Developers
Introduction to AngularJS For WordPress Developers
 
Django Rest Framework and React and Redux, Oh My!
Django Rest Framework and React and Redux, Oh My!Django Rest Framework and React and Redux, Oh My!
Django Rest Framework and React and Redux, Oh My!
 
Backbone.js — Introduction to client-side JavaScript MVC
Backbone.js — Introduction to client-side JavaScript MVCBackbone.js — Introduction to client-side JavaScript MVC
Backbone.js — Introduction to client-side JavaScript MVC
 
Developing ASP.NET Applications Using the Model View Controller Pattern
Developing ASP.NET Applications Using the Model View Controller PatternDeveloping ASP.NET Applications Using the Model View Controller Pattern
Developing ASP.NET Applications Using the Model View Controller Pattern
 
MEAN - Notes from the field (Full-Stack Development with Javascript)
MEAN - Notes from the field (Full-Stack Development with Javascript)MEAN - Notes from the field (Full-Stack Development with Javascript)
MEAN - Notes from the field (Full-Stack Development with Javascript)
 
[Bristol WordPress] Supercharging WordPress Development
[Bristol WordPress] Supercharging WordPress Development[Bristol WordPress] Supercharging WordPress Development
[Bristol WordPress] Supercharging WordPress Development
 
Fatc
FatcFatc
Fatc
 
Ultimate Introduction To AngularJS
Ultimate Introduction To AngularJSUltimate Introduction To AngularJS
Ultimate Introduction To AngularJS
 
Backbone Basics with Examples
Backbone Basics with ExamplesBackbone Basics with Examples
Backbone Basics with Examples
 

More from AgileThought (6)

Control Freak: Risk and Control in Azure DevOps
Control Freak: Risk and Control in Azure DevOpsControl Freak: Risk and Control in Azure DevOps
Control Freak: Risk and Control in Azure DevOps
 
Adventures in Agile Testing
Adventures in Agile TestingAdventures in Agile Testing
Adventures in Agile Testing
 
From Device To Cloud
From Device To CloudFrom Device To Cloud
From Device To Cloud
 
Operationalizing Machine Learning
Operationalizing Machine LearningOperationalizing Machine Learning
Operationalizing Machine Learning
 
The Agile Journey
The Agile JourneyThe Agile Journey
The Agile Journey
 
Psychology In UX
Psychology In UXPsychology In UX
Psychology In UX
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Recently uploaded (20)

Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 

Patterns Are Good For Managers

  • 1. Patterns Are Good For Managers Presented by Michael Cooper, Senior Consultant
  • 2. Not all of your devscan be like him. Without a Superman, you need: •Team Productivity •On Boarding •Standardized Code & Patterns •Code Documentation •Test Coverage •Quality www.agilethought.com 2 http://moviepilot.com/posts/2014/07/04/those-batman-v-superman-rumors-faked-by- warner-bros-1673661?lt_source=external,manual
  • 3. These require a disciplined approach. www.agilethought.com 3
  • 4. Making Swim Lanes … Your devsknow MVC .NET MVC, Java Spring, around since 1970s www.agilethought.com 4
  • 5. MVC encourages SOLID code. www.agilethought.com 5 Models Views Controllers ServiceLayer MVC Model classes View templates, Html Helpers MVC Razor code Controller Service Layer code Angular Model factory classes View templates Directives Moustache code Controllers Services
  • 6. The pattern allows us to have many people working on the same project. www.agilethought.com 6 Dev A DevsB&C DevsB&C Dev D And new-to-Angular devsneed to only learn one area / pattern … allowing them to be productive within one week. Models Views Controllers ServiceLayer
  • 7. The pattern allows our test patterns to be standardized, giving us high coverage. www.agilethought.com 7 Model Unit Tests Functional Tests Controller Unit Tests Service Unit Tests Integration Tests Karma/Jasmine Protractor, Frisby Models Views Controllers ServiceLayer
  • 8. An eco-system to support the Angular pattern. •Project template •Automated test setup •Live templates (Intellij) that build models, controllers, services and their tests •Lots of examples •Proof it works! •Recently completed project: 83% UI code coverage www.agilethought.com 8
  • 9. Code Samples –MVC Angular www.agilethought.com 9
  • 10. Named Spaced Modules www.agilethought.com 10
  • 11. Templates, Partial Views www.agilethought.com 11
  • 12. Controller www.agilethought.com 12 .NET MVC Angular public classHomeController: Controller{ public ActionResultAbout() { ViewBag[“name"] = “Dolly"; return View(); } } [HttpPost] public ActionResultAbout(form){ //something } .config(function config( $stateProvider) { $stateProvider.state( 'about', { url: '/about', views: { "main": { controller: HomeAboutController', templateUrl: 'about/about.tpl.html' } }) .controller(‘HomeAboutController', function HomeAboutController( $scope ) { $scope.name = ‘Dolly’; $state.go(‘about’); $scope.respond= function(){ //something } ; });
  • 13. HTML Helpers/Directives www.agilethought.com 13 .NET MVC Angular public static class HtmlHelperExtensions{ public static MvcHtmlStringCustomTextBox(this HtmlHelperhtmlHelper, string name, string value) { varbuilder = new TagBuilder(“input”); builder.MergeAttribute(“type”, “text”); builder.MergeAttribute(“name”, name); builder.MergeAttribute(“value”, value); return MvcHtmlString .Create(builder.ToString( TagRenderMode.SelfClosing)); } } .directive(“CustomTextBox”, function(){ return { template:‘<input type=“text” name={{name}} value={{value}} />’, restrict: ‘E’, scope: { name: ‘=‘, value: ‘=‘ } } }); use:@Html.CustomTextBox(“custom_txtbox”,”Custom Helper Method”) use:<custom-text-box name=“custom_txtbox” value=“Custom Helper Method”/>
  • 14. Models www.agilethought.com 14 .NET MVC Angular public class Animal{ publicAnimal(); public string name {get;set;} public void Run(speed){ // do something } } .factory(“Animal”, function(){ varAnimal= function(){ this.name = ‘’; } Animal.prototype.Run= function(){ // do something } return Animal; }); use: varhorse= new Animal(); horse.name = “George”; horse.Run(); use: varhorse= new Animal(); horse.name = ‘George’; horse.Run();
  • 15. Services Persistence www.agilethought.com 15 .NET MVC Angular public staticclass StoreAnimals{ private AnimalStorebarn; public void Save(Animal animal){ barn.Animals.add(animal); } } .service(“StoreAnimals”, function($http){ varsave = function(animal){ return $http.POST( AnimalStore, angular.toJSON(animal)); } return:{ save: save } }); use: varhorse= new Animal(); horse.name = “George”; StoreAnimals.Save(horse); use: varhorse= new Animal(); horse.name = ‘George’; StoreAnimals.save(horse).promise.then(function(){ //next thing });
  • 16. Dependency Injection www.agilethought.com 16 .NET MVC Angular public staticclass StoreAnimals{ vardb; publicStoreAnimals(db){ this.db= db } public void Save(Animalanimal){ db.Save(animal); } } angular.module(‘myApp.store’, [ ‘myApp.database’]) .service(“StoreAnimals”, function(db){ varsave = function(animal){ return db.Save(animal); } return:{ save: save } });
  • 17. Code Documentation www.agilethought.com 17 .NET MVC Angular public staticclass StoreAnimals{ vardb; publicStoreAnimals(db){ this.db= db } /// <summary> /// Stores an animal /// </summary> /// <paramname=“animal">the one to /// persist</param> /// <returns></returns> public void Save(Animalanimal){ db.Save(animal); } } angular.module(‘myApp.store’, [ ‘myApp.database’]) .service(“StoreAnimals”, function(db){ /** * @method Save -Stores an animal * @param{Animal}animal –the one to persist */ varsave = function(animal){ return db.Save(animal); } return:{ save: save } });
  • 18. Visit our library of free webinar videos! Previous Webinars: •Azure + Visual Studio Online: How to build, test, deploy and monitor seamlessly •6 Steps To Achieving Predictable Release Management With Visual Studio 2013 •How To Create High Value Development Teams •5 TFS Features That Will Dramatically Improve Your Team's Performance 18
  • 19. About Michael 19 Mike Cooper spent much of his career in software sales, development and general management, with large firms like Reuters and Pitney Bowes, and a series of start-ups. His true love is making great software, and he has built software for television, finance, construction and government, and co-founded a number of veteran–owned businesses.He is a consultant at AgileThought, specializing in AngularJS. Thank You @mbcoop Questions about AngularJS? Email me at Michael.Cooper@agilethought.com linkedin.com/in/michaelcooper