I want to inject the momentJs library in my typescript code to do operations on a Date object. But I am not familiar with injecting typescript through angularJs, since it is little different from javascript.
angular.module("app")
.config(function ($mdDateLocaleProvider) {
$mdDateLocaleProvider.formatDate = function (date) {
return moment(date).format('YYYY-MM-DD');
};
});
In the above code, the moment
function is not recognized, even though I have included the CDN.
After you add all necessary scripts of moment.js in your page.
Use it like this and try