Wednesday, 15 May 2013

angularjs - Postpone angular directive until data is ready -



angularjs - Postpone angular directive until data is ready -

i have angular js directive take date , format 2014-06-01t00:00:00 2014-06-01 within of input.

the directive loads , executes fine, problem is, date i'm trying format part of model must first retrieved web service. because done asynchronously, directive execute before info has come server, causes undefines sent directive, , date remaining unformatted.

is there way prevent happening, or perhaps improve way format date maybe?

thank kindly

i think can utilize date filter:

<span >{{ yourdate | date:'yyyy-mm-dd '}}</span>

see doc: https://docs.angularjs.org/api/ng/filter/date

angularjs

No comments:

Post a Comment