duh...passing $scope to the function