After spending an hour trying to figure out what went wrong, I still can't solve this problem. I've searched on stackoverflow for answers, but nothing seems to be helpful. The issue arises when trying to integrate Moment js into my project.
- Checked this link (https://github.com/urish/angular-moment)
- Followed all the instructions provided.
- Encountered an error: angular is not defined at angular-moment.js:630.
This is the snippet of my code:
index.html
<!-- moment extension -->
<script src="lib/moment/moment.js"></script>
<script src="lib/angular-moment/angular-moment.js"></script>
<!-- ionic/angularjs js -->
<script src="http://maps.googleapis.com/maps/api/js?libraries=places&sensor=false"></script>
<script src="lib/ionic/js/ionic.bundle.js"></script>
<script src="cordova.js"></script>
<script src="lib/ionic-timepicker/dist/ionic-timepicker.bundle.min.js"></script>
<script src="lib/ngCordova/dist/ng-cordova.min.js"></script>
Javascript
angular.module('starter.controller', ['ionic', 'ionic-timepicker', 'angularMoment'])
.controller('checkoutOrderCtrl', function ($scope, moment) {
var NowMoment = moment();
$rootScope.date = NowMoment.format('YYYY-MM-DD');
$rootScope.time = NowMoment.format('h:mm:ss');
}
Your assistance will be greatly appreciated.