implemented timer using angular's $interval