SlideShare a Scribd company logo
Advanced Developer Conference 2013

Rainer Stropek
software architects gmbh

Web http://www.timecockpit.com
Mail rainer@timecockpit.com
Twitter @rstropek

Silverlight-Style HTML Apps
Saves the day.
Read/Download Sourcecode of Samples at
http://bit.ly/AngularTypeScript
Agenda

Introduction Learn
What‘s it all about?

Image Source:
http://flic.kr/p/9bUJEX

Angular by example

Image Source:
http://flic.kr/p/3budHy

How far?
What didn‘t we cover?
How far can it go?

Image Source:
http://flic.kr/p/765iZj

Stop or go?
Critical evaluation

Image Source:
http://flic.kr/p/973C1u
TypeScript


This presentation uses AngularJS with TypeScript
JavaScript is generated from TypeScript
However, you still have to understand the concepts of JavaScript



TypeScript advantages
Type-safe AngularJS API (at least most part of it)
Native classes, interfaces, etc. instead of JavaScript patterns and conventions
Possibility to have strongly typed models
Possibility to have strongly typed REST services



TypeScript disadvantages
Only a few AngularJS + TypeScript samples available
Additional compilation step necessary
Introduction
What‘s it all about?

Image Source:
http://flic.kr/p/9bUJEX
What‘s AngularJS
Developer‘s Perspective
 MVC

+ data binding framework

Fully based on HTML, JavaScript, and CSS  Plugin-free
Enables automatic unit testing

 Dependency

injection system

Module concept with dependency management

 Handles

communication with server

XHR, REST, and JSONP
Promise API for asynchronous programming
What‘s AngularJS
Developer‘s Perspective
 Navigation

solution for SPAs

Single Page Applications

 HTML

extensibility mechanism

Custom directives
MVC
View

Model

Layers

HTML

View: Visual appearance
(declarative languages)
Model: Data model of the app
(JavaScript objects)
Controller: Adds behavior
(imperative languages)

CSS

Controller

Workflow

JavaScript

User

Architectural Pattern

API

Server
Data Binding

User interacts with the view
Changes the model, calls
controller (data binding)
Controller manipulates
model, interacts with server
AngularJS detects model
changes and updates the
view (two-way data binding)
MVC Notes
 MVW

= Model View Whatever

MVC is not a precise pattern but an architectural pattern

 Clear

separation of logic, view, and data model

Data binding connects the layers

 Enables

automated unit tests

Test business logic and UI behavior (also kind of logic) without automated UI tests
Important Differences


HTML+CSS for view



Plugin-free
Extensibility introduced by AngularJS



Data binding introduced by
AngularJS

XAML for view
Silverlight browser plugin
Extensibility built in (e.g. user controls)



Change detection using model comparison

Data binding built into XAML
and .NET
INotifyPropertyChanged, Dependency
Properties



JavaScript





Many different development
environments

CLR-based languages (e.g.
C#)



First-class support in Visual
Studio

Open Source

Provided by Microsoft
Shared Code
JavaScript/TypeScript Everywhere

Client
Data Model

Logic

Server
Data Model

Logic

Shared code between
client and server
Server: nodejs
Single source for logic
and data model

Mix with other server-side
platforms possible
E.g. ASP.NET
angular.module('helloWorldApp', [])
.config(function ($routeProvider) {
$routeProvider
.when('/', {
templateUrl: 'views/main.html',
controller: 'MainCtrl'
})
.when('/about', {
templateUrl: 'views/about.html',
controller: 'AboutCtrl'
})
.otherwise({
redirectTo: '/'
});
});
angular.module('helloWorldApp')
.controller('MainCtrl', function ($scope) {
…
});

<div class="container"
ng-view="">
</div>

<div class="hero-unit">
<h1>'Allo, 'Allo!</h1>
…
</div>

SPA
Single Page Apps

Define routes with
$routeProvider service
Placeholder with „:“ (e.g.
/admin/users/:userid)
Access route paramter values with
$routeParams service

Define where view should be
included in index.html using
ng-view
URL Modes
Hashbang and HTML5 mode
See $location service docs for details
Tools



Microsoft Visual Studio

Open Source Tools

Not free
Only Windows
Very good support for TypeScript
Integrated debugging with IE
Build with MSBUILD
Package management with NuGet







Yoeman
angular-seed
Bower for web package management



Your favorite editor
Some free, some not free
E.g. Sublime, Notepad++, Vim, etc.
Build and test with external tools

Build
Grunt for automated build
Karma test runner
Jasmine for BDD unit tests
JSLint, JSHint for code quality

JetBrains WebStorm
Not free
Windows, Mac, Linux
Specialized on web apps
Good integration of external tools

Project setup



UI
Bootstrap CSS for prettifying UI
AngularUI for UI utilities and controls
Batarang for analyzing data bindings and scopes



Server-side
nodejs for server-side JavaScript with
various npm modules (e.g. express)
Setup demo project
cd yeoman-demo
yo angular hello-world

Demo
Yeoman Angular Generator

Build and test your app (don‘t forget to set CHROME_BIN)
grunt

Add one item to awesomeThings in main.js
Run automated unit tests  will fail
grunt test
Correct unit test to expect 4 instead of 3 items
Run automated unit tests  will work
grunt test
Start development loop
grunt server
Change main.js, save it, and watch the browser refreshing
Add a new view + controller + route, look at changes in app.js
yo angular:route about
Start development loop, launch new route (maybe with Fiddler)
http://localhost:9000/#/about

Setup angular application
Initial setup
Add new artifacts (e.g. route)

Run unit tests
Karma and Jasmine

Code editing with editor
Sublime text
Learn
Angular by example

Image Source:
http://flic.kr/p/3budHy
Project Setup
In Visual Studio

Create HTML app with
TypeScript
Use NuGet to add angular
and bootstrap
Get TypeScript declaration
from GitHub

Demo

Basic controller with twoway data binding
Collections
Binding to Collections

Create collection in
controller
Binding the view to
collections

Demo
Scopes
Hierarchy of Scopes

Sample with hierarchy of
scopes
Analyze scope hierarchy
with Batarang

Demo

Sample inspired by Kozlowski, Pawel; Darwin, Peter Bacon:
Mastering Web Application Development with
AngularJS, Chapter Hierarchy of scopes
…
<body ng-app="notificationsApp" ng-controller="NotificationsCtrl">
…
</body>
module NotificationsModule { …
export class NotificationsCtrl {
constructor(
private $scope: INotificationsCtrlScope,
private notificationService: NotificationsService) { … }
…
}
export class NotificationsService {
…
public static Factory(
…,
MAX_LEN: number, greeting: string) { … }
}

Modules, Services
Dependency Injection

AngularJS module system
Typically one module per
application or
reusable, shared component

Predefined services
E.g.
$rootElement, $location, $co
mpile, …

}
angular.module("notificationsApp", …)
.constant("MAX_LEN", 10)
.value("greeting", "Hello World!")
.controller("NotificationsCtrl",
NotificationsModule.NotificationsCtrl)
.factory("notificationService",
NotificationsModule.NotificationsService.Factory);

Dependency Injection
Based on parameter names
Tip: Use $inject instead of
param names to be
minification-safe
Modules, Services
Dependency Injection

TypeScript modules vs.
AngularJS modules
AngularJS modules and
factories

Demo

Sample inspired by Kozlowski, Pawel; Darwin, Peter Bacon:
Mastering Web Application Development with
AngularJS, Collaborating Objects
Server Communication
 $http

service (ng.IHttpService)

Support for XHR and JSONP

 $resource

service for very simple REST services

Not covered in this talk; see AngularJS docs for details

 $q

service for lightweight promise API

Note: $http methods return IHttpPromise<T>

 $httpBackend

service (ng.IHttpBackendService)

Used for unit testing of $http calls
$http
Server Communication

Create Cloud Backend
Azure Mobile Service

Access REST service
using $http service

Unit testing with
$httpBackend
Build UI with Bootstrap

Demo
How Far?
What didn‘t we cover?
How far can it go?

Image Source:
http://flic.kr/p/765iZj
angular.module('MyReverseModule', [])
.filter('reverse', function() {
return function(input, uppercase) {
var out = "";
for (var i = 0; i < input.length; i++) {
out = input.charAt(i) + out;
}
// conditional based on optional argument
if (uppercase) {
out = out.toUpperCase();
}
return out;
}
});
function Ctrl($scope) {
$scope.greeting = 'hello';
}
<body>
<div ng-controller="Ctrl">
<input ng-model="greeting" type="greeting"><br>
No filter: {{greeting}}<br>
Reverse: {{greeting|reverse}}<br>
Reverse + uppercase: {{greeting|reverse:true}}<br>
</div>
</body>

Filters
Standard and Custom Filters

Formatting filters
currency
date
json
lowercase
number
uppercase

Array-transforming filters
filter
limitTo
orderBy

Custom filters (see left)
Source of custom filter sample: AngularJS docs
Advanced $http
 Interceptors
Used e.g. for retry logic, authentication, etc.

 Support
 For

for JSONP

details see AngularJS docs
myModule.directive('button', function() {
return {
restrict: 'E',
compile: function(element, attributes) {
element.addClass('btn');
if (attributes.type === 'submit') {
element.addClass('btn-primary');
}
if (attributes.size) {
element.addClass('btn-' + attributes.size);
}
}
}
}

Directives
Custom Directives and Widgets

Not covered in details
here
For details see AngularJS docs
Localization
 Internationalization

(i18n)

Abstracting strings and other locale-specific bits (such as date or currency formats)
out of the application

 Localization

(L10n)

Providing translations and localized formats

 For

details see AngularJS docs
Further Readings, Resources
 AngularJS

Intellisense in Visual Studio 2012

See Mads Kristensen‘s blog

 Recommended

Book

Kozlowski, Pawel; Darwin, Peter Bacon: Mastering Web Application Development with
AngularJS

 Sample

code from this presentation

http://bit.ly/AngularTypeScript
Stop or Go?
Critical Evaluation

Image Source:
http://flic.kr/p/973C1u
Stop or Go?
 Many

moving parts sometimes lead to problems

You have to combine many projects
Development tools
Services, UI components (directives, widgets), IDE/build components

 You

still have to test on all target platforms

Operating systems
Browsers

 Learning

curve for C#/.NET developers

Programming language, framework, runtime, IDE
Stop or Go?
 TypeScript

for productivity

Type information helps detecting error at development time

 Clear

separation between view and logic

Testability
Possible code reuse between server and client

 One

framework covering many aspects

Less puzzle pieces

 Relatively

large developer team

AngularJS by Google
Advanced Developer Conference 2013

Rainer Stropek
software architects gmbh

Q&A

Mail rainer@timecockpit.com
Web http://www.timecockpit.com
Twitter @rstropek

Thank your for coming!
Saves the day.
is the leading time tracking solution for knowledge workers.
Graphical time tracking calendar, automatic tracking of your work using
signal trackers, high level of extensibility and customizability, full support to
work offline, and SaaS deployment model make it the optimal choice
especially in the IT consulting business.
Try
for free and without any risk. You can get your trial
account at http://www.timecockpit.com. After the trial period you can use
for only 0,20€ per user and month without a minimal subscription time and
without a minimal number of users.
Ad

More Related Content

What's hot (20)

AngularJS Basics with Example
AngularJS Basics with ExampleAngularJS Basics with Example
AngularJS Basics with Example
Sergey Bolshchikov
 
Building scalable applications with angular js
Building scalable applications with angular jsBuilding scalable applications with angular js
Building scalable applications with angular js
Andrew Alpert
 
Workshop 1: Good practices in JavaScript
Workshop 1: Good practices in JavaScriptWorkshop 1: Good practices in JavaScript
Workshop 1: Good practices in JavaScript
Visual Engineering
 
AngularJS Directives
AngularJS DirectivesAngularJS Directives
AngularJS Directives
Eyal Vardi
 
Intro to Angular.JS Directives
Intro to Angular.JS DirectivesIntro to Angular.JS Directives
Intro to Angular.JS Directives
Christian Lilley
 
AngularJS Services
AngularJS ServicesAngularJS Services
AngularJS Services
Eyal Vardi
 
Vue.js + Django - configuración para desarrollo con webpack y HMR
Vue.js + Django - configuración para desarrollo con webpack y HMRVue.js + Django - configuración para desarrollo con webpack y HMR
Vue.js + Django - configuración para desarrollo con webpack y HMR
Javier Abadía
 
Practical AngularJS
Practical AngularJSPractical AngularJS
Practical AngularJS
Wei Ru
 
Sane Async Patterns
Sane Async PatternsSane Async Patterns
Sane Async Patterns
TrevorBurnham
 
Workshop 12: AngularJS Parte I
Workshop 12: AngularJS Parte IWorkshop 12: AngularJS Parte I
Workshop 12: AngularJS Parte I
Visual Engineering
 
Modules and injector
Modules and injectorModules and injector
Modules and injector
Eyal Vardi
 
Angular js routing options
Angular js routing optionsAngular js routing options
Angular js routing options
Nir Kaufman
 
Building Custom AngularJS Directives - A Step-by-Step Guide - Dan Wahlin | Fa...
Building Custom AngularJS Directives - A Step-by-Step Guide - Dan Wahlin | Fa...Building Custom AngularJS Directives - A Step-by-Step Guide - Dan Wahlin | Fa...
Building Custom AngularJS Directives - A Step-by-Step Guide - Dan Wahlin | Fa...
FalafelSoftware
 
Template syntax in Angular 2.0
Template syntax in Angular 2.0Template syntax in Angular 2.0
Template syntax in Angular 2.0
Eyal Vardi
 
IndexedDB - Querying and Performance
IndexedDB - Querying and PerformanceIndexedDB - Querying and Performance
IndexedDB - Querying and Performance
Parashuram N
 
Workshop 5: JavaScript testing
Workshop 5: JavaScript testingWorkshop 5: JavaScript testing
Workshop 5: JavaScript testing
Visual Engineering
 
Frontin like-a-backer
Frontin like-a-backerFrontin like-a-backer
Frontin like-a-backer
Frank de Jonge
 
Asynchronous JS in Odoo
Asynchronous JS in OdooAsynchronous JS in Odoo
Asynchronous JS in Odoo
Odoo
 
Upgrading from Angular 1.x to Angular 2.x
Upgrading from Angular 1.x to Angular 2.xUpgrading from Angular 1.x to Angular 2.x
Upgrading from Angular 1.x to Angular 2.x
Eyal Vardi
 
Java script object model
Java script object modelJava script object model
Java script object model
James Hsieh
 
Building scalable applications with angular js
Building scalable applications with angular jsBuilding scalable applications with angular js
Building scalable applications with angular js
Andrew Alpert
 
Workshop 1: Good practices in JavaScript
Workshop 1: Good practices in JavaScriptWorkshop 1: Good practices in JavaScript
Workshop 1: Good practices in JavaScript
Visual Engineering
 
AngularJS Directives
AngularJS DirectivesAngularJS Directives
AngularJS Directives
Eyal Vardi
 
Intro to Angular.JS Directives
Intro to Angular.JS DirectivesIntro to Angular.JS Directives
Intro to Angular.JS Directives
Christian Lilley
 
AngularJS Services
AngularJS ServicesAngularJS Services
AngularJS Services
Eyal Vardi
 
Vue.js + Django - configuración para desarrollo con webpack y HMR
Vue.js + Django - configuración para desarrollo con webpack y HMRVue.js + Django - configuración para desarrollo con webpack y HMR
Vue.js + Django - configuración para desarrollo con webpack y HMR
Javier Abadía
 
Practical AngularJS
Practical AngularJSPractical AngularJS
Practical AngularJS
Wei Ru
 
Workshop 12: AngularJS Parte I
Workshop 12: AngularJS Parte IWorkshop 12: AngularJS Parte I
Workshop 12: AngularJS Parte I
Visual Engineering
 
Modules and injector
Modules and injectorModules and injector
Modules and injector
Eyal Vardi
 
Angular js routing options
Angular js routing optionsAngular js routing options
Angular js routing options
Nir Kaufman
 
Building Custom AngularJS Directives - A Step-by-Step Guide - Dan Wahlin | Fa...
Building Custom AngularJS Directives - A Step-by-Step Guide - Dan Wahlin | Fa...Building Custom AngularJS Directives - A Step-by-Step Guide - Dan Wahlin | Fa...
Building Custom AngularJS Directives - A Step-by-Step Guide - Dan Wahlin | Fa...
FalafelSoftware
 
Template syntax in Angular 2.0
Template syntax in Angular 2.0Template syntax in Angular 2.0
Template syntax in Angular 2.0
Eyal Vardi
 
IndexedDB - Querying and Performance
IndexedDB - Querying and PerformanceIndexedDB - Querying and Performance
IndexedDB - Querying and Performance
Parashuram N
 
Workshop 5: JavaScript testing
Workshop 5: JavaScript testingWorkshop 5: JavaScript testing
Workshop 5: JavaScript testing
Visual Engineering
 
Asynchronous JS in Odoo
Asynchronous JS in OdooAsynchronous JS in Odoo
Asynchronous JS in Odoo
Odoo
 
Upgrading from Angular 1.x to Angular 2.x
Upgrading from Angular 1.x to Angular 2.xUpgrading from Angular 1.x to Angular 2.x
Upgrading from Angular 1.x to Angular 2.x
Eyal Vardi
 
Java script object model
Java script object modelJava script object model
Java script object model
James Hsieh
 

Similar to AngularJS with TypeScript and Windows Azure Mobile Services (20)

Front End Development for Back End Developers - vJUG24 2017
Front End Development for Back End Developers - vJUG24 2017Front End Development for Back End Developers - vJUG24 2017
Front End Development for Back End Developers - vJUG24 2017
Matt Raible
 
Googleappengineintro 110410190620-phpapp01
Googleappengineintro 110410190620-phpapp01Googleappengineintro 110410190620-phpapp01
Googleappengineintro 110410190620-phpapp01
Tony Frame
 
Angular Javascript Tutorial with command
Angular Javascript Tutorial with commandAngular Javascript Tutorial with command
Angular Javascript Tutorial with command
ssuser42b933
 
AngularJS = Browser applications on steroids
AngularJS = Browser applications on steroidsAngularJS = Browser applications on steroids
AngularJS = Browser applications on steroids
Maurice De Beijer [MVP]
 
Angular Js Basics
Angular Js BasicsAngular Js Basics
Angular Js Basics
أحمد عبد الوهاب
 
Ionic framework one day training
Ionic framework one day trainingIonic framework one day training
Ionic framework one day training
Troy Miles
 
GWT Extreme!
GWT Extreme!GWT Extreme!
GWT Extreme!
cromwellian
 
Karlsruher Entwicklertag 2013 - Webanwendungen mit AngularJS
Karlsruher Entwicklertag 2013 - Webanwendungen mit AngularJSKarlsruher Entwicklertag 2013 - Webanwendungen mit AngularJS
Karlsruher Entwicklertag 2013 - Webanwendungen mit AngularJS
Philipp Burgmer
 
AngularJS 1.x training
AngularJS 1.x trainingAngularJS 1.x training
AngularJS 1.x training
Roberto Ramadhin
 
Google Cloud Endpoints: Building Third-Party APIs on Google AppEngine
Google Cloud Endpoints: Building Third-Party APIs on Google AppEngineGoogle Cloud Endpoints: Building Third-Party APIs on Google AppEngine
Google Cloud Endpoints: Building Third-Party APIs on Google AppEngine
Roman Kirillov
 
Angular js
Angular jsAngular js
Angular js
Behind D Walls
 
Front End Development for Back End Developers - UberConf 2017
Front End Development for Back End Developers - UberConf 2017Front End Development for Back End Developers - UberConf 2017
Front End Development for Back End Developers - UberConf 2017
Matt Raible
 
Startup eng-camp 3
Startup eng-camp 3Startup eng-camp 3
Startup eng-camp 3
Jollen Chen
 
WJAX 2012 - Web Apps With AngularJS
WJAX 2012 - Web Apps With AngularJSWJAX 2012 - Web Apps With AngularJS
WJAX 2012 - Web Apps With AngularJS
Philipp Burgmer
 
ZZ BC#7.5 asp.net mvc practice and guideline refresh!
ZZ BC#7.5 asp.net mvc practice  and guideline refresh! ZZ BC#7.5 asp.net mvc practice  and guideline refresh!
ZZ BC#7.5 asp.net mvc practice and guideline refresh!
Chalermpon Areepong
 
Angular for Java Enterprise Developers: Oracle Code One 2018
Angular for Java Enterprise Developers: Oracle Code One 2018Angular for Java Enterprise Developers: Oracle Code One 2018
Angular for Java Enterprise Developers: Oracle Code One 2018
Loiane Groner
 
Intro to AngularJs
Intro to AngularJsIntro to AngularJs
Intro to AngularJs
SolTech, Inc.
 
Maciej Treder "Server-side rendering with Angular—be faster and more SEO, CDN...
Maciej Treder "Server-side rendering with Angular—be faster and more SEO, CDN...Maciej Treder "Server-side rendering with Angular—be faster and more SEO, CDN...
Maciej Treder "Server-side rendering with Angular—be faster and more SEO, CDN...
Fwdays
 
I Know It Was MEAN, But I Cut the Cord to LAMP Anyway
I Know It Was MEAN, But I Cut the Cord to LAMP AnywayI Know It Was MEAN, But I Cut the Cord to LAMP Anyway
I Know It Was MEAN, But I Cut the Cord to LAMP Anyway
POSSCON
 
Angular js
Angular jsAngular js
Angular js
Silver Touch Technologies Ltd
 
Front End Development for Back End Developers - vJUG24 2017
Front End Development for Back End Developers - vJUG24 2017Front End Development for Back End Developers - vJUG24 2017
Front End Development for Back End Developers - vJUG24 2017
Matt Raible
 
Googleappengineintro 110410190620-phpapp01
Googleappengineintro 110410190620-phpapp01Googleappengineintro 110410190620-phpapp01
Googleappengineintro 110410190620-phpapp01
Tony Frame
 
Angular Javascript Tutorial with command
Angular Javascript Tutorial with commandAngular Javascript Tutorial with command
Angular Javascript Tutorial with command
ssuser42b933
 
AngularJS = Browser applications on steroids
AngularJS = Browser applications on steroidsAngularJS = Browser applications on steroids
AngularJS = Browser applications on steroids
Maurice De Beijer [MVP]
 
Ionic framework one day training
Ionic framework one day trainingIonic framework one day training
Ionic framework one day training
Troy Miles
 
Karlsruher Entwicklertag 2013 - Webanwendungen mit AngularJS
Karlsruher Entwicklertag 2013 - Webanwendungen mit AngularJSKarlsruher Entwicklertag 2013 - Webanwendungen mit AngularJS
Karlsruher Entwicklertag 2013 - Webanwendungen mit AngularJS
Philipp Burgmer
 
Google Cloud Endpoints: Building Third-Party APIs on Google AppEngine
Google Cloud Endpoints: Building Third-Party APIs on Google AppEngineGoogle Cloud Endpoints: Building Third-Party APIs on Google AppEngine
Google Cloud Endpoints: Building Third-Party APIs on Google AppEngine
Roman Kirillov
 
Front End Development for Back End Developers - UberConf 2017
Front End Development for Back End Developers - UberConf 2017Front End Development for Back End Developers - UberConf 2017
Front End Development for Back End Developers - UberConf 2017
Matt Raible
 
Startup eng-camp 3
Startup eng-camp 3Startup eng-camp 3
Startup eng-camp 3
Jollen Chen
 
WJAX 2012 - Web Apps With AngularJS
WJAX 2012 - Web Apps With AngularJSWJAX 2012 - Web Apps With AngularJS
WJAX 2012 - Web Apps With AngularJS
Philipp Burgmer
 
ZZ BC#7.5 asp.net mvc practice and guideline refresh!
ZZ BC#7.5 asp.net mvc practice  and guideline refresh! ZZ BC#7.5 asp.net mvc practice  and guideline refresh!
ZZ BC#7.5 asp.net mvc practice and guideline refresh!
Chalermpon Areepong
 
Angular for Java Enterprise Developers: Oracle Code One 2018
Angular for Java Enterprise Developers: Oracle Code One 2018Angular for Java Enterprise Developers: Oracle Code One 2018
Angular for Java Enterprise Developers: Oracle Code One 2018
Loiane Groner
 
Maciej Treder "Server-side rendering with Angular—be faster and more SEO, CDN...
Maciej Treder "Server-side rendering with Angular—be faster and more SEO, CDN...Maciej Treder "Server-side rendering with Angular—be faster and more SEO, CDN...
Maciej Treder "Server-side rendering with Angular—be faster and more SEO, CDN...
Fwdays
 
I Know It Was MEAN, But I Cut the Cord to LAMP Anyway
I Know It Was MEAN, But I Cut the Cord to LAMP AnywayI Know It Was MEAN, But I Cut the Cord to LAMP Anyway
I Know It Was MEAN, But I Cut the Cord to LAMP Anyway
POSSCON
 
Ad

Recently uploaded (20)

Automation Dreamin' 2022: Sharing Some Gratitude with Your Users
Automation Dreamin' 2022: Sharing Some Gratitude with Your UsersAutomation Dreamin' 2022: Sharing Some Gratitude with Your Users
Automation Dreamin' 2022: Sharing Some Gratitude with Your Users
Lynda Kane
 
Hands On: Create a Lightning Aura Component with force:RecordData
Hands On: Create a Lightning Aura Component with force:RecordDataHands On: Create a Lightning Aura Component with force:RecordData
Hands On: Create a Lightning Aura Component with force:RecordData
Lynda Kane
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
Network Security. Different aspects of Network Security.
Network Security. Different aspects of Network Security.Network Security. Different aspects of Network Security.
Network Security. Different aspects of Network Security.
gregtap1
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
Automation Hour 1/28/2022: Capture User Feedback from Anywhere
Automation Hour 1/28/2022: Capture User Feedback from AnywhereAutomation Hour 1/28/2022: Capture User Feedback from Anywhere
Automation Hour 1/28/2022: Capture User Feedback from Anywhere
Lynda Kane
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5..."Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
Fwdays
 
Asthma presentación en inglés abril 2025 pdf
Asthma presentación en inglés abril 2025 pdfAsthma presentación en inglés abril 2025 pdf
Asthma presentación en inglés abril 2025 pdf
VanessaRaudez
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
Leading AI Innovation As A Product Manager - Michael Jidael
Leading AI Innovation As A Product Manager - Michael JidaelLeading AI Innovation As A Product Manager - Michael Jidael
Leading AI Innovation As A Product Manager - Michael Jidael
Michael Jidael
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Rock, Paper, Scissors: An Apex Map Learning Journey
Rock, Paper, Scissors: An Apex Map Learning JourneyRock, Paper, Scissors: An Apex Map Learning Journey
Rock, Paper, Scissors: An Apex Map Learning Journey
Lynda Kane
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Automation Dreamin': Capture User Feedback From Anywhere
Automation Dreamin': Capture User Feedback From AnywhereAutomation Dreamin': Capture User Feedback From Anywhere
Automation Dreamin': Capture User Feedback From Anywhere
Lynda Kane
 
Automation Dreamin' 2022: Sharing Some Gratitude with Your Users
Automation Dreamin' 2022: Sharing Some Gratitude with Your UsersAutomation Dreamin' 2022: Sharing Some Gratitude with Your Users
Automation Dreamin' 2022: Sharing Some Gratitude with Your Users
Lynda Kane
 
Hands On: Create a Lightning Aura Component with force:RecordData
Hands On: Create a Lightning Aura Component with force:RecordDataHands On: Create a Lightning Aura Component with force:RecordData
Hands On: Create a Lightning Aura Component with force:RecordData
Lynda Kane
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
Network Security. Different aspects of Network Security.
Network Security. Different aspects of Network Security.Network Security. Different aspects of Network Security.
Network Security. Different aspects of Network Security.
gregtap1
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
Automation Hour 1/28/2022: Capture User Feedback from Anywhere
Automation Hour 1/28/2022: Capture User Feedback from AnywhereAutomation Hour 1/28/2022: Capture User Feedback from Anywhere
Automation Hour 1/28/2022: Capture User Feedback from Anywhere
Lynda Kane
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5..."Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
Fwdays
 
Asthma presentación en inglés abril 2025 pdf
Asthma presentación en inglés abril 2025 pdfAsthma presentación en inglés abril 2025 pdf
Asthma presentación en inglés abril 2025 pdf
VanessaRaudez
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
Leading AI Innovation As A Product Manager - Michael Jidael
Leading AI Innovation As A Product Manager - Michael JidaelLeading AI Innovation As A Product Manager - Michael Jidael
Leading AI Innovation As A Product Manager - Michael Jidael
Michael Jidael
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Rock, Paper, Scissors: An Apex Map Learning Journey
Rock, Paper, Scissors: An Apex Map Learning JourneyRock, Paper, Scissors: An Apex Map Learning Journey
Rock, Paper, Scissors: An Apex Map Learning Journey
Lynda Kane
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Automation Dreamin': Capture User Feedback From Anywhere
Automation Dreamin': Capture User Feedback From AnywhereAutomation Dreamin': Capture User Feedback From Anywhere
Automation Dreamin': Capture User Feedback From Anywhere
Lynda Kane
 
Ad

AngularJS with TypeScript and Windows Azure Mobile Services

  • 1. Advanced Developer Conference 2013 Rainer Stropek software architects gmbh Web http://www.timecockpit.com Mail [email protected] Twitter @rstropek Silverlight-Style HTML Apps Saves the day.
  • 2. Read/Download Sourcecode of Samples at http://bit.ly/AngularTypeScript
  • 3. Agenda Introduction Learn What‘s it all about? Image Source: http://flic.kr/p/9bUJEX Angular by example Image Source: http://flic.kr/p/3budHy How far? What didn‘t we cover? How far can it go? Image Source: http://flic.kr/p/765iZj Stop or go? Critical evaluation Image Source: http://flic.kr/p/973C1u
  • 4. TypeScript  This presentation uses AngularJS with TypeScript JavaScript is generated from TypeScript However, you still have to understand the concepts of JavaScript  TypeScript advantages Type-safe AngularJS API (at least most part of it) Native classes, interfaces, etc. instead of JavaScript patterns and conventions Possibility to have strongly typed models Possibility to have strongly typed REST services  TypeScript disadvantages Only a few AngularJS + TypeScript samples available Additional compilation step necessary
  • 5. Introduction What‘s it all about? Image Source: http://flic.kr/p/9bUJEX
  • 6. What‘s AngularJS Developer‘s Perspective  MVC + data binding framework Fully based on HTML, JavaScript, and CSS  Plugin-free Enables automatic unit testing  Dependency injection system Module concept with dependency management  Handles communication with server XHR, REST, and JSONP Promise API for asynchronous programming
  • 7. What‘s AngularJS Developer‘s Perspective  Navigation solution for SPAs Single Page Applications  HTML extensibility mechanism Custom directives
  • 8. MVC View Model Layers HTML View: Visual appearance (declarative languages) Model: Data model of the app (JavaScript objects) Controller: Adds behavior (imperative languages) CSS Controller Workflow JavaScript User Architectural Pattern API Server Data Binding User interacts with the view Changes the model, calls controller (data binding) Controller manipulates model, interacts with server AngularJS detects model changes and updates the view (two-way data binding)
  • 9. MVC Notes  MVW = Model View Whatever MVC is not a precise pattern but an architectural pattern  Clear separation of logic, view, and data model Data binding connects the layers  Enables automated unit tests Test business logic and UI behavior (also kind of logic) without automated UI tests
  • 10. Important Differences  HTML+CSS for view  Plugin-free Extensibility introduced by AngularJS  Data binding introduced by AngularJS XAML for view Silverlight browser plugin Extensibility built in (e.g. user controls)  Change detection using model comparison Data binding built into XAML and .NET INotifyPropertyChanged, Dependency Properties  JavaScript   Many different development environments CLR-based languages (e.g. C#)  First-class support in Visual Studio Open Source Provided by Microsoft
  • 11. Shared Code JavaScript/TypeScript Everywhere Client Data Model Logic Server Data Model Logic Shared code between client and server Server: nodejs Single source for logic and data model Mix with other server-side platforms possible E.g. ASP.NET
  • 12. angular.module('helloWorldApp', []) .config(function ($routeProvider) { $routeProvider .when('/', { templateUrl: 'views/main.html', controller: 'MainCtrl' }) .when('/about', { templateUrl: 'views/about.html', controller: 'AboutCtrl' }) .otherwise({ redirectTo: '/' }); }); angular.module('helloWorldApp') .controller('MainCtrl', function ($scope) { … }); <div class="container" ng-view=""> </div> <div class="hero-unit"> <h1>'Allo, 'Allo!</h1> … </div> SPA Single Page Apps Define routes with $routeProvider service Placeholder with „:“ (e.g. /admin/users/:userid) Access route paramter values with $routeParams service Define where view should be included in index.html using ng-view URL Modes Hashbang and HTML5 mode See $location service docs for details
  • 13. Tools  Microsoft Visual Studio Open Source Tools Not free Only Windows Very good support for TypeScript Integrated debugging with IE Build with MSBUILD Package management with NuGet    Yoeman angular-seed Bower for web package management  Your favorite editor Some free, some not free E.g. Sublime, Notepad++, Vim, etc. Build and test with external tools Build Grunt for automated build Karma test runner Jasmine for BDD unit tests JSLint, JSHint for code quality JetBrains WebStorm Not free Windows, Mac, Linux Specialized on web apps Good integration of external tools Project setup  UI Bootstrap CSS for prettifying UI AngularUI for UI utilities and controls Batarang for analyzing data bindings and scopes  Server-side nodejs for server-side JavaScript with various npm modules (e.g. express)
  • 14. Setup demo project cd yeoman-demo yo angular hello-world Demo Yeoman Angular Generator Build and test your app (don‘t forget to set CHROME_BIN) grunt Add one item to awesomeThings in main.js Run automated unit tests  will fail grunt test Correct unit test to expect 4 instead of 3 items Run automated unit tests  will work grunt test Start development loop grunt server Change main.js, save it, and watch the browser refreshing Add a new view + controller + route, look at changes in app.js yo angular:route about Start development loop, launch new route (maybe with Fiddler) http://localhost:9000/#/about Setup angular application Initial setup Add new artifacts (e.g. route) Run unit tests Karma and Jasmine Code editing with editor Sublime text
  • 15. Learn Angular by example Image Source: http://flic.kr/p/3budHy
  • 16. Project Setup In Visual Studio Create HTML app with TypeScript Use NuGet to add angular and bootstrap Get TypeScript declaration from GitHub Demo Basic controller with twoway data binding
  • 17. Collections Binding to Collections Create collection in controller Binding the view to collections Demo
  • 18. Scopes Hierarchy of Scopes Sample with hierarchy of scopes Analyze scope hierarchy with Batarang Demo Sample inspired by Kozlowski, Pawel; Darwin, Peter Bacon: Mastering Web Application Development with AngularJS, Chapter Hierarchy of scopes
  • 19. … <body ng-app="notificationsApp" ng-controller="NotificationsCtrl"> … </body> module NotificationsModule { … export class NotificationsCtrl { constructor( private $scope: INotificationsCtrlScope, private notificationService: NotificationsService) { … } … } export class NotificationsService { … public static Factory( …, MAX_LEN: number, greeting: string) { … } } Modules, Services Dependency Injection AngularJS module system Typically one module per application or reusable, shared component Predefined services E.g. $rootElement, $location, $co mpile, … } angular.module("notificationsApp", …) .constant("MAX_LEN", 10) .value("greeting", "Hello World!") .controller("NotificationsCtrl", NotificationsModule.NotificationsCtrl) .factory("notificationService", NotificationsModule.NotificationsService.Factory); Dependency Injection Based on parameter names Tip: Use $inject instead of param names to be minification-safe
  • 20. Modules, Services Dependency Injection TypeScript modules vs. AngularJS modules AngularJS modules and factories Demo Sample inspired by Kozlowski, Pawel; Darwin, Peter Bacon: Mastering Web Application Development with AngularJS, Collaborating Objects
  • 21. Server Communication  $http service (ng.IHttpService) Support for XHR and JSONP  $resource service for very simple REST services Not covered in this talk; see AngularJS docs for details  $q service for lightweight promise API Note: $http methods return IHttpPromise<T>  $httpBackend service (ng.IHttpBackendService) Used for unit testing of $http calls
  • 22. $http Server Communication Create Cloud Backend Azure Mobile Service Access REST service using $http service Unit testing with $httpBackend Build UI with Bootstrap Demo
  • 23. How Far? What didn‘t we cover? How far can it go? Image Source: http://flic.kr/p/765iZj
  • 24. angular.module('MyReverseModule', []) .filter('reverse', function() { return function(input, uppercase) { var out = ""; for (var i = 0; i < input.length; i++) { out = input.charAt(i) + out; } // conditional based on optional argument if (uppercase) { out = out.toUpperCase(); } return out; } }); function Ctrl($scope) { $scope.greeting = 'hello'; } <body> <div ng-controller="Ctrl"> <input ng-model="greeting" type="greeting"><br> No filter: {{greeting}}<br> Reverse: {{greeting|reverse}}<br> Reverse + uppercase: {{greeting|reverse:true}}<br> </div> </body> Filters Standard and Custom Filters Formatting filters currency date json lowercase number uppercase Array-transforming filters filter limitTo orderBy Custom filters (see left) Source of custom filter sample: AngularJS docs
  • 25. Advanced $http  Interceptors Used e.g. for retry logic, authentication, etc.  Support  For for JSONP details see AngularJS docs
  • 26. myModule.directive('button', function() { return { restrict: 'E', compile: function(element, attributes) { element.addClass('btn'); if (attributes.type === 'submit') { element.addClass('btn-primary'); } if (attributes.size) { element.addClass('btn-' + attributes.size); } } } } Directives Custom Directives and Widgets Not covered in details here For details see AngularJS docs
  • 27. Localization  Internationalization (i18n) Abstracting strings and other locale-specific bits (such as date or currency formats) out of the application  Localization (L10n) Providing translations and localized formats  For details see AngularJS docs
  • 28. Further Readings, Resources  AngularJS Intellisense in Visual Studio 2012 See Mads Kristensen‘s blog  Recommended Book Kozlowski, Pawel; Darwin, Peter Bacon: Mastering Web Application Development with AngularJS  Sample code from this presentation http://bit.ly/AngularTypeScript
  • 29. Stop or Go? Critical Evaluation Image Source: http://flic.kr/p/973C1u
  • 30. Stop or Go?  Many moving parts sometimes lead to problems You have to combine many projects Development tools Services, UI components (directives, widgets), IDE/build components  You still have to test on all target platforms Operating systems Browsers  Learning curve for C#/.NET developers Programming language, framework, runtime, IDE
  • 31. Stop or Go?  TypeScript for productivity Type information helps detecting error at development time  Clear separation between view and logic Testability Possible code reuse between server and client  One framework covering many aspects Less puzzle pieces  Relatively large developer team AngularJS by Google
  • 32. Advanced Developer Conference 2013 Rainer Stropek software architects gmbh Q&A Mail [email protected] Web http://www.timecockpit.com Twitter @rstropek Thank your for coming! Saves the day.
  • 33. is the leading time tracking solution for knowledge workers. Graphical time tracking calendar, automatic tracking of your work using signal trackers, high level of extensibility and customizability, full support to work offline, and SaaS deployment model make it the optimal choice especially in the IT consulting business. Try for free and without any risk. You can get your trial account at http://www.timecockpit.com. After the trial period you can use for only 0,20€ per user and month without a minimal subscription time and without a minimal number of users.