Files
BitwiseCmd/app/controllers.js
2015-04-03 18:55:39 +03:00

44 lines
1.1 KiB
JavaScript

(function(app, is){
app.controller('expressionInputCtrl', {
$dispatcher:null,
onViewAttached: function () {
var d = this.$dispatcher;
this.viewElement.focus();
this.viewElement.addEventListener('keyup', function (args) {
if (args.keyCode != 13) {
return;
}
// Enter
d.dispatch(args.srcElement.value);
args.srcElement.value = '';
});
}
});
app.service('resultView', {
$html: null,
clear: function (){
this.viewElement.innerHTML = '';
},
onViewAttached: function(el) {
var r = 1;
},
display: function ( model) {
var view = app.buildViewFor(model);
var vw = this.viewElement;
if(vw.childNodes.length == 0) {
vw.appendChild(view);
}
else {
vw.insertBefore(view, vw.childNodes[0]);
}
}
});
app.controller('resultViewCtrl', app.service('resultView'));
})(window.app, window.is);