Replaced service location by dependency injection

This commit is contained in:
Borys Levytskyi
2015-04-03 03:39:55 +03:00
parent 569c335368
commit 86349c9c30
5 changed files with 104 additions and 100 deletions

View File

@@ -1,15 +1,16 @@
(function(app){
app.controller('expressionInputCtrl', {
$dispatcher:null,
attachView: function (viewElement) {
var dispatcher = app.service('dispatcher');
viewElement.addEventListener('keyup', function (args) {
if (args.keyCode != 13) {
return;
}
// Enter
dispatcher.dispatch(args.srcElement.value);
this.$dispatcher.dispatch(args.srcElement.value);
args.srcElement.value = '';
});
}