Code isn't working on Ionic View, only in ionic serve

My code takes this button bar and it acts like a filter. It changes color to show the user what filter option is currently being viewed.

The HTML:
My code takes this button bar and it acts like a filter. It changes color to show the user what filter option is currently being viewed.

http://pastebin.com/XEVGXVxq
(I couldn’t format it right in this)

This code is working when I use Ionic serve but not when I view it on my phone in ionic view and I was wondering why. I was thinking possible because of the use of the document object but even if so I have no idea how to fix this. Any advice? Thanks so much!

The Javascript:

.controller(‘scheduleCtrl’, [’$scope’, ‘$stateParams’,
function scheduleController ($scope, $stateParams) {
$scope.data = {
“filter” : “”,
“events”: getEvents()
// alert()
};
$scope.updateButtons = function(btn){
document.getElementById(‘schedule-Practice’).style = "background: opaque; "
document.getElementById(‘schedule-all’).style = "background: opaque; "
document.getElementById(‘schedule-Games’).style = "background: opaque; “
document.getElementById(btn).style = " background: transparent ; color: #ff9c33
}
}])
This code is working when I use Ionic serve but not when I view it on my phone in ionic view and I was wondering why. I was thinking possible because of the use of the document object but even if so I have no idea how to fix this. Any advice? Thanks so much!