Reputation: 1722
I am trying to print momentjs object not ISO8601 string within angularjs templates.
let's say I have something i.e
$scope.time = moment();
and in my template when I do the following
<span ng-bind="time"></span>
or <span>{{time}}</span>
I guess what I am trying to do is to avoid calling momentjs toString()
or .toJSON()
object which might be triggers by {{}}
, however, I do not want to override those function that are chained onto moments prototype.
Upvotes: 2
Views: 511
Reputation: 1722
<span ng-bind="demo.$time.toObject()|json"></span>
http://momentjs.com/docs/#/displaying/as-object/
Upvotes: 4