Cambiando la manera de pensar las UIs
angular.component('pruebaCmp',{
template: 'prueba.template.html',
controller: pruebaCtrl,
bindings: {
nombre: '<',
onClick: '&'
}
})
@Component({selector: 'prueba-cmp'})
class PruebaCmp {
@Input() name;
@Output() complete = new EventEmitter();
onCompletedButton() {
this.complete.next();
}
}
var ToggleText = React.createClass({
getInitialState: function () {
return {
showDefault: true
}
},
toggle: function (e) {
this.setState({ showDefault: !this.state.showDefault })
},
render: function () {
var message = this.props.default;
return (
<div>
<h1>Hello {message}!</h1>
<a href="" onClick={this.toggle}>Toggle</a>
</div>
);
}
});
MyElement = Polymer({
is: 'my-element',
properties: {
fancy: Boolean
},
created: function() {
this.textContent = 'My element!';
},
onClick: function(){
this.textContent = 'Text Change!';
}
});
Vue.component('post', {
template: "#post-template",
props: ['post'],
data: function () {
return {
upvoted: false,
downvoted: false
};
},
methods: {
upvote: function () {
this.upvoted = !this.upvoted;
this.downvoted = false;
}
}
});