Adding Javascript to a Controller

How should I add a getelementbyID to a existing controller? Should it be:

.controller(‘ProductCtrl’, function(Products, $scope, $stateParams, $state, $timeout) {
$scope.product = Products[$stateParams.productId];

$scope.$on("$ionicView.loaded", function() {
document.getElementById(‘myVideo’).addEventListener(‘ended’,myHandler,false);
function myHandler(e) {
$state.go(‘app.home’);
}

or perhaps done in another way?