Use the usual dirty trick:
this.counter = 1;
this.getMessages = function() {
var that = this;
$timeout(function() {
console.log(that.counter); // <--- this will show undefined
that.counter++; // <--- this.counter is undefined
}, 300);
return false;
}