Linked Questions

Popular Questions

Including Moment.js in angular 1 project

Asked by At

Earlier I had worked with moment.js in a project and now I need to use it with another project. I need to use this library in an angular 1 controller.

I have included the same from a CDN but if I try to inject it into my controller it gives me weird errors.

<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.1/moment.min.js"></script>

The above line is placed in index.html where I give links to other libraries via CDN's

This is the beginning of my controller

angular.module('app').controller('homeCntr', ['$scope','$http','$stateParams', function ($scope,$http, $stateParams)
{

Here where should I give the path/name for moment.js so that it works perfectly and allows me to use moment inside this controller.?

Related Questions