I am trying to use the moment-duration-format plugin to format the duration of MomentJS. How can I use this plugin in my Angular controllers? It looks like it should work out of the box after JS has been imported, but it is not.
I imported the instant JS and MDF JS file into my index.html:
// MomentJS
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.3/moment.min.js"></script>
// moment-duration-format plugin
<script src="bower_components/moment-duration-format/lib/moment-duration-format.js"></script>
But when I call the bottom line in the controller, I get an error message:
console.log( moment.duration(123, "minutes").format("h:mm") );
Error:
TypeError: moment.duration(...).format is not a function...
Alexg source
share