Oliver Zeigermann / @DJCordhose
Janos Koschwitz / @JanosKoschwitz
Online-Version: http://bit.ly/1VTfUZX
Code auf Github: https://github.com/DJCordhose/javascript-web-frameworks
Copyright 2015, Mike North (@michaellnorth), https://twitter.com/ModernWebUI/status/575532649948790784/photo/1
Copyright 2015, Oliver Zeigermann
Copyright 2015, Oliver Zeigermann
Copyright 2015, Oliver Zeigermann
Code-Stil basiert auf (halb-) offizieller Empfehlung
function HelloController() {
var vm = this; // define view model
vm.greeting = 'Hello';
vm.clear = function () {
vm.greeting = '';
document.getElementById('in').focus();
};
}
<body np-app ng-controller="HelloController as helloController">
<input ng-model="helloController.greeting" id="in">
<p>{{helloController.greeting}}, World!</p>
<input type="button" value="Clear"
ng-click="helloController.clear()">
</body>
Run
<link rel="import" href="greeter-element.html">
<greeter-element greeting="Hello"></greeter-element>
// greeter-element.html
Polymer({
is: "greeter-element",
reset: function() {
this.greeting = "";
this.$.in.focus();
}
});
<dom-module id="greeter-element">
<template>
<input id="in" value="{{greeting::keyup}}">
{{greeting}}, World!
<input type="button" value="Clear" on-click="reset">
</template>
</dom-module>
Run
"Don't waste time making trivial choices"
from emberjs.com
// handlebars/htmlbars template
{{input id="in" value=greeting}}
{{greeting}}, World
<input type="button" value="Clear" {{action 'clear'}}>
export default Ember.Controller.extend({
greeting : "Hello",
actions: {
clear: function() {
this.set('greeting','');
$('#in').focus();
}
}
});
If you follow the Ember way
you will like the Ember way
Janos Koschwitz
class HelloMessage extends React.Component {
render() {
return (
<input value={this.state.greeting} ref="in"
onChange={this.updateModel.bind(this)} />
{this.state.greeting}, World
<button onClick={this.reset.bind(this)}>Clear</button>
);
}
constructor(props) {
this.state = {greeting: this.props.greeting};
}
updateModel(event) {
this.setState({greeting: event.target.value});
}
reset() {
this.setState({greeting: ""});
this.refs.in.focus();
}
}
// index.html
<body>
</body>
// main.js
import HelloMessage from './HelloMessage';
var mountNode = document.getElementById('mount');
ReactDOM.render(<HelloMessage greeting="Hello"/>, mountNode);
Run
@Component({
selector: 'hello-app'
})
@View({
template:
`<input [value]="greeting" #in (keyup)="updateModel(in.value)">
<p>{{greeting}}, World</p>
<button (click)="reset(in)">Clear</button>`
})
class HelloCmp {
greeting: string;
constructor() {
this.greeting = 'Hello';
}
reset(input) {
this.greeting = '';
input.focus();
}
updateModel(value) {
this.greeting = value;
}
}
bootstrap(HelloCmp);
<body>
<hello-app></hello-app>
<script>System.import('app');</script>
</body>
Run
User Experience | Developer Experience | Standards | Investitionssicherheit | |
---|---|---|---|---|
Angular 1 | + (langsam bei vielen Komponenten) |
o (viel Magie, Komponenten unnötig komplex) |
- (Angular-way eher Java-Stil) |
o (muss migriert werden) |
Polymer | + (nur in Chrome optimal) |
o (bisher nur geringe Toolunterstützung) |
+ (basiert auf Standard und 1.0) |
o (1.0, aber wer setzt das ein?) |
Ember | ++ | + (Ember Way) - (Ember Way) |
+ | + (stabile Community) |
React | ++ | Für JS-Dev: ++ (Turnaroundzeiten)
Für Java-Dev: o (viel neues) |
+ | + (Einsatz bei Facebook, Rückwärtskompatibilität) |
Angular 2 | ++ (vermutlich) | o (vieles neu) |
+ | - (bisher kein Release) |
Disclaimer: basierend auf unseren Erfahrungen
Oliver Zeigermann / @DJCordhose
Janos Koschwitz / @JanosKoschwitz