I started learning “proper” angular recently. I love it so far.
I was building a little job posting app. When displaying jobs and comments, I had to show the time since it was posted. Doing it in a controller or a service doesn’t make sense as this is something you need throughout your app.
“Ah, what a oppurtunity to create a custom directive”, I thought.
Now in your views, you just have to write the below html and it will show the date in time-ago format.
I don’t know if this is the best solution for this. But I will keep udpating here as I discover more ways to improve it.