SlideShare ist ein Scribd-Unternehmen logo
1 von 16
Downloaden Sie, um offline zu lesen
using AngularJS with
TypeScript
by david pichsenmeister
TypeScript
● TypeScript is a typed superset of
JavaScript that compiles to plain
JavaScript (ECMAScript3-compatible).
● TypeScript adds optional types, classes,
modules and generics
● (only) compile-time type checking
TypeScript
you can
● use existing JavaScript code
● incorporate popular JavaScript libraries
● call it from other JavaScript code
TypeScript
● can be installed as a node.js package
npm install -g typescript

● compiled with TypeScript compiler
tsc helloworld.ts

● reference files with
/// <reference path='path/to/file.ts' />
DefinitelyTyped
● repository for high-quality TypeScript
type definitions
● type definitions for all common
frameworks and libraries
● has its own package manager for
definitions (tsd)
TSD - TypeScript Definition
Manager
● install via npm
npm install -g tsd

● install definitions
tsd query angular --resolve --action
install
CODE
https://github.com/3x14159265/angularTs
reference all files
/// <reference path='typings/jquery/jquery.d.ts' />
/// <reference path='typings/angularjs/angular.d.ts' />
/// <reference path='typings/angularjs/angular-route.d.ts' />
//##### models #####
/// <reference path='models/ScaffoldModel.ts' />
//##### services #####
/// <reference path='services/ScaffoldService.ts' />
//##### directives #####
/// <reference path='directives/ScaffoldDirective.ts' />
//##### controllers #####
/// <reference path='controllers/ScaffoldCtrl.ts' />
/// <reference path='app.ts' />
app.ts
/// <reference path='_all.ts' />
module app {
'use strict'
var myapp: ng.IModule = angular.module( 'app', ['ngRoute'])
myapp.controller( 'ctrl', ScaffoldCtrl.prototype.injection())
myapp.service( 'service', ScaffoldService.prototype.injection())
myapp.directive( 'directive' , ScaffoldDirective.prototype.injection())
myapp.config([ '$routeProvider' , function( $routeProvider: ng.route.
IRouteProvider ) {
$routeProvider.when( '/home', {templateUrl: 'partials/home.
html'}).
otherwise({redirectTo: '/home'})
}])
}
model

/// <reference path='../_all.ts' />
module app {
'use strict'
export class ScaffoldModel {
constructor(){}
}
}
controller
/// <reference path='../_all.ts' />
module app {
'use strict'
export class ScaffoldCtrl {
public injection(): Array<any> {
return [
ScaffoldCtrl
]
}
constructor() {}
}
}
service
/// <reference path='../_all.ts' />
module app {
'use strict'
export class ScaffoldService {
public injection(): Array<any> {
return [
ScaffoldService
]
}
constructor() {}
}
}
directive 1/2
/// <reference path='../_all.ts' />
module app {
'use strict'
export class ScaffoldDirective implements ng.IDirective {
public injection(): Array<any> {
return [
() => { return new ScaffoldDirective() }
]
}
directive 2/2
public templateUrl: string
public restrict: string
constructor() {
this.templateUrl = 'partials/templates/directive.html'
this.restrict = 'E'
}
public link ($scope: ng.IScope, element: JQuery, attributes:
ng.IAttributes): void {
element.text(
"i'm a directive")
}
}
}
resources
http://www.typescriptlang.org/
http://angularjs.org/
http://nodejs.org/
https://github.com/borisyankov/DefinitelyTyped
http://definitelytyped.github.io/tsd/
https://github.com/3x14159265/angularTs
thanks!
feel free to add me on:

.../3x14159265

Weitere ähnliche Inhalte

Andere mochten auch

warp engine - an open source realtime push engine
warp engine - an open source realtime push enginewarp engine - an open source realtime push engine
warp engine - an open source realtime push engineDavid Pichsenmeister
 
Building Better AngularJS 1.X Apps With TypeScript
Building Better AngularJS 1.X Apps With TypeScriptBuilding Better AngularJS 1.X Apps With TypeScript
Building Better AngularJS 1.X Apps With TypeScriptColdFusionConference
 
Introduction to Angular with TypeScript for .NET Developers
Introduction to Angular with TypeScript for .NET DevelopersIntroduction to Angular with TypeScript for .NET Developers
Introduction to Angular with TypeScript for .NET DevelopersLaurent Duveau
 
Typescript in 30mins
Typescript in 30mins Typescript in 30mins
Typescript in 30mins Udaya Kumar
 
Multi modularized project setup with gulp, typescript and angular.js
Multi modularized project setup with gulp, typescript and angular.jsMulti modularized project setup with gulp, typescript and angular.js
Multi modularized project setup with gulp, typescript and angular.jsDavid Amend
 
Will Chatbots kill apps? - Vienna Valley #7
Will Chatbots kill apps? - Vienna Valley #7Will Chatbots kill apps? - Vienna Valley #7
Will Chatbots kill apps? - Vienna Valley #7David Pichsenmeister
 

Andere mochten auch (11)

warp engine - an open source realtime push engine
warp engine - an open source realtime push enginewarp engine - an open source realtime push engine
warp engine - an open source realtime push engine
 
Bot Trends 2016
Bot Trends 2016Bot Trends 2016
Bot Trends 2016
 
Bot Trends 2017
Bot Trends 2017Bot Trends 2017
Bot Trends 2017
 
Building Better AngularJS 1.X Apps With TypeScript
Building Better AngularJS 1.X Apps With TypeScriptBuilding Better AngularJS 1.X Apps With TypeScript
Building Better AngularJS 1.X Apps With TypeScript
 
Using TypeScript with Angular
Using TypeScript with AngularUsing TypeScript with Angular
Using TypeScript with Angular
 
Introduction to Angular with TypeScript for .NET Developers
Introduction to Angular with TypeScript for .NET DevelopersIntroduction to Angular with TypeScript for .NET Developers
Introduction to Angular with TypeScript for .NET Developers
 
Typescript in 30mins
Typescript in 30mins Typescript in 30mins
Typescript in 30mins
 
Multi modularized project setup with gulp, typescript and angular.js
Multi modularized project setup with gulp, typescript and angular.jsMulti modularized project setup with gulp, typescript and angular.js
Multi modularized project setup with gulp, typescript and angular.js
 
Getting started with typescript
Getting started with typescriptGetting started with typescript
Getting started with typescript
 
Will Chatbots kill apps? - Vienna Valley #7
Will Chatbots kill apps? - Vienna Valley #7Will Chatbots kill apps? - Vienna Valley #7
Will Chatbots kill apps? - Vienna Valley #7
 
Introduction to Angularjs
Introduction to AngularjsIntroduction to Angularjs
Introduction to Angularjs
 

Mehr von David Pichsenmeister

Bots as Marketing Channels for Events
Bots as Marketing Channels for EventsBots as Marketing Channels for Events
Bots as Marketing Channels for EventsDavid Pichsenmeister
 
The art of building successful products
The art of building successful productsThe art of building successful products
The art of building successful productsDavid Pichsenmeister
 
Vue.js SSR with Nuxt.js and Firebase
Vue.js SSR with Nuxt.js and Firebase Vue.js SSR with Nuxt.js and Firebase
Vue.js SSR with Nuxt.js and Firebase David Pichsenmeister
 
Work at oratio - Tools for distributed teams
Work at oratio - Tools for distributed teamsWork at oratio - Tools for distributed teams
Work at oratio - Tools for distributed teamsDavid Pichsenmeister
 
Chatbots - Canonical Interfaces as new Communication Channels
Chatbots - Canonical Interfaces as new Communication ChannelsChatbots - Canonical Interfaces as new Communication Channels
Chatbots - Canonical Interfaces as new Communication ChannelsDavid Pichsenmeister
 

Mehr von David Pichsenmeister (7)

Bots as Marketing Channels for Events
Bots as Marketing Channels for EventsBots as Marketing Channels for Events
Bots as Marketing Channels for Events
 
The art of building successful products
The art of building successful productsThe art of building successful products
The art of building successful products
 
Basics of Product Strategy
Basics of Product StrategyBasics of Product Strategy
Basics of Product Strategy
 
Vue.js SSR with Nuxt.js and Firebase
Vue.js SSR with Nuxt.js and Firebase Vue.js SSR with Nuxt.js and Firebase
Vue.js SSR with Nuxt.js and Firebase
 
Work at oratio - Tools for distributed teams
Work at oratio - Tools for distributed teamsWork at oratio - Tools for distributed teams
Work at oratio - Tools for distributed teams
 
How to build a great bot
How to build a great botHow to build a great bot
How to build a great bot
 
Chatbots - Canonical Interfaces as new Communication Channels
Chatbots - Canonical Interfaces as new Communication ChannelsChatbots - Canonical Interfaces as new Communication Channels
Chatbots - Canonical Interfaces as new Communication Channels
 

Kürzlich hochgeladen

TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...itnewsafrica
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 

Kürzlich hochgeladen (20)

TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 

using AngularJS with TypeScript