Refactoring of task events using $scope.$emit

Related to #119.

Work in progress.