I am getting the below error when I run my angularApp.
angular.module('angularApp', ['comment','commentList', 'commentForm',
'commentBox','momentModule']) ?????
.run(function($rootScope) {
$rootScope.comments = {
'author': 'Santiago',
'msg': 'Msg 1', id: 1, 'date': "04/17/2016"
}, {'author': 'Pablo', 'msg': 'Msg 2', id: 2, 'date': "05/01/2016"};
});
angular.js:4087 Uncaught Error: [$injector:modulerr] Failed to instantiate
module angularApp due to:
Error: [$injector:modulerr] Failed to instantiate module commentList due to:
**** Error: [$injector:modulerr] Failed to instantiate module moment due
to: ???????
Error: [$injector:nomod] Module 'moment' is not available! You either
misspelled the module name or forgot to load it. If registering a module
ensure that you specify the dependencies as the second argument.
It is failing to instantiate the momentModule. This module is a factory
injector where I wish to inject angular-moment into another module .
Pretty simple but I'm having trouble figuring out how to inject it into an
app without controllers. I only have the RUN method in the app. All I did
was add the momentModule directive to the angularApp run method array.
My momentModule factory:
angular
.module('momentModule', [])
.factory('moment', function ($window) {
return $window.moment;
});
angular-moment.js and moment.js are loaded in bower_components and ready to
roll and I didn't misspell it.
Below is one of modules where I want to inject the moment factory window into
but as I said I get the error moment isn't even instantiaint
angular.module('commentList', ['comment','moment']) ????????
.directive('commentList', function () {
return {
template: '<div class="commentList">' +
'<comment-model ng-repeat="comment in comments"
author="{{comment.author}}">' +
'{{comment.msg}}' +' '+' '+
'{{comment.time | date: "MM-dd-yyyy"}} '+' '+' '+
'{{comment.time }} '+' '+' '+
// '<time am-time-ago="comment.time"></time>+
'</comment-model>' +
'<span ng-if="comments.length < 1">No comments yet</span>' +
'</div>$c',
restrict: 'E',
scope: {
comments: '='
},
link: function postLink(scope, element, attrs) {
}
};
});
Many many thanks,
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.