Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Time display not updating? #231

Closed
chrismanderson opened this issue Mar 16, 2016 · 3 comments
Closed

Time display not updating? #231

chrismanderson opened this issue Mar 16, 2016 · 3 comments

Comments

@chrismanderson
Copy link

With version 0.10.3, and a simple

$scope.message = {
  text: 'hello world!',
  time: new Date()
};

and using

<span>{{message.time | amDateFormat:'dddd, MMMM Do YYYY, h:mm:ss a'}}</span>

I'm not seeing the time actually update, no matter how long I wait. That should be happening by default, right?

@urish
Copy link
Owner

urish commented Mar 18, 2016

Hi, the amDateFormat filter does not update automatically. Only the am-time-ago directive does...

@urish urish closed this as completed Mar 18, 2016
@chrismanderson
Copy link
Author

Ok, thanks for that info. Obvious feature request, have the filters update too :). Thanks for getting back to me!

@urish
Copy link
Owner

urish commented Mar 19, 2016

Unfortunately, in Angular 1.0, filters can't trigger an update, that's the reason am-time-ago was implemented as a directive.

In your case, you can probably work around this by periodically triggering a digest cycle, something like:

setTimeout(function(){$rootScope.$digest();}, 1000);

But this will severely affect performance in larger application.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants