JSLab conference
Odessa, March 12, 2016
evgeniy.safronov@outlook.com
@javacodegeek
https://github.com/javacodegeek
Misko Heverly
Naomi Black
Brad Green
Igor Minar
Jules Kremer
Pete Becon Darwin
Tomas Burleson
AngularJS was originally developed in 2009 Misko Heverly and Adam Abronsom in Brat Tech LLC
Angular 2 was announced in October 2014
Angular 2 Beta in December 15, 2015
June 13, 2012 version 1.0.0
January 13, 2015 version 1.3.9
May 26, 2015 version 1.4.0
February 5, 2016 version 1.5.0
Beta means that most developers can be successful building large applications using Angular 2.
Through developer preview and alpha team was worked closely with several large projects at Google including AdWords, GreenTea, and Google Fiber.
Externally, they were worked closely with several other teams integrating with Angular 2 including Ionic Framework on Ionic 2, Telerik on NativeScript, Rangle.io on Batarangle, and many others.
They incorporated the majority of feedback from these teams that would create breaking changes.
Controllers
Directive Definition
Object
$scope
Angular module
jqLite
Template
< >
Component{...}
Metadata
Property binding
Event binding
Injector
Directive
{...}
Metadata
{{value}}
DOM
Component
[property]="value"
(event)="handler"
[(ng-model)}="property"
import {Component} from 'angular2/angular2'
@Component({
selector: 'my-component',
template: '<div>Hello my name is {{name}}. <button (click)="sayMyName()">Say my name</button></div>'
})
export class MyComponent {
constructor() {
this.name = 'Odessa'
}
sayMyName() {
console.log('My name is', this.name)
}
}
export class HelloService {
constructor(
private _backend: BackendService,
private _logger: Logger) { }
private _msgs:Msg[] = [];
getMsgs() {
this._backend.getAll(Msg).then( (msgs:Msg[]) => {
this._logger.log(`Fetched ${msgs.length} msgs.`);
this._msgs.push(...msgs);
});
return this._msgs;
}
}
TypeScript is a language for application-scale JavaScript. TypeScript adds optional types, classes, and modules to JavaScript. TypeScript supports tools for large-scale JavaScript applications for any browser, for any host, on any OS. TypeScript compiles to readable, standards-based JavaScript.
Our project folder structure looks like this:
{
"compilerOptions": {
"target": "es5",
"module": "system",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
},
"exclude": [
"node_modules",
"typings/main",
"typings/main.d.ts"
]
}
{
"ambientDependencies": {
"es6-shim": "github:DefinitelyTyped/DefinitelyTyped/es6-shim/es6-shim.d.ts#4de74cb527395c13ba20b438c3a7a419ad931f1c",
"jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#d594ef506d1efe2fea15f8f39099d19b39436b71"
}
}
{
"name": "angular2-odessa-jslab",
"version": "1.0.0",
"scripts": {
"start": "concurrently \"npm run tsc:w\" \"npm run lite\" ",
"tsc": "tsc",
"tsc:w": "tsc -w",
"lite": "lite-server",
"typings": "typings",
"postinstall": "typings install"
},
"license": "ISC",
"dependencies": {
"angular2": "2.0.0-beta.9",
"systemjs": "0.19.24",
"es6-promise": "^3.0.2",
"es6-shim": "^0.33.3",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.2",
"zone.js": "0.5.15"
},
"devDependencies": {
"concurrently": "^2.0.0",
"lite-server": "^2.1.0",
"typescript": "^1.8.7",
"typings":"^0.7.5"
}
}
import {Component} from 'angular2/core';
@Component({
selector: 'jslab-app',
template: '<h1>Hello, Odessa!</h1>'
})
export class AppComponent { }
import {bootstrap} from 'angular2/platform/browser'
import {AppComponent} from './app.component'
bootstrap(AppComponent);
<html>
<head>
<title>Angular 2 Odessa JSLab</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles.css">
<!-- 1. Load libraries -->
<!-- IE required polyfills, in this exact order -->
<script src="node_modules/es6-shim/es6-shim.min.js"></script>
<script src="node_modules/systemjs/dist/system-polyfills.js"></script>
<script src="node_modules/angular2/es6/dev/src/testing/shims_for_IE.js"></script>
<script src="node_modules/angular2/bundles/angular2-polyfills.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="node_modules/rxjs/bundles/Rx.js"></script>
<script src="node_modules/angular2/bundles/angular2.dev.js"></script>
...
...
<!-- 2. Configure SystemJS -->
<script>
System.config({
packages: {
app: {
format: 'register',
defaultExtension: 'js'
}
}
});
System.import('app/main')
.then(null, console.error.bind(console));
</script>
</head>
<!-- 3. Display the application -->
<body>
<jslab-app>Loading...</jslab-app>
</body>
</html>
John Papa is a Google Developer Expert, Microsoft Regional Director and MVP, and author of 100+ articles and 10 books, and is a former technology Evangelist for Microsoft client teams. He specializes in professional development with HTML5, JavaScript, CSS, Angular, Gulp, Node.js, Knockout, C#, and ASP.NET.
A starting point for Angular development teams to provide consistency through good practices
Angular 2 Style Gid now in DRAFT
16.665
If you are looking for an opinionated style guide for syntax, conventions, and structuring Angular applications, then step right in.
Oficial docs
Courses
Books
March 21-23, Munich
April 16, London
September 27-28, London
October 25-26, Paris
May 14-15, 2016