I got rid of $window and injected only 'moment' into the commentForm. It
should work now but I get the injector error below?To troublehsoot, I
removed the weird bower_components subdirectory and cleaned the bower cache
and reinstalled moment & angular-moments.with bower and now it is fixed.
I also stopped grunt and reserved. It looks right to me. Is there any
dependency I need in the commentForm that moment might need? The
index.HTML file has the right links for angular, angular-moment and
moment.and should load but it says I might have misspelled it. I have
checked spelling over and over tried moment-module and momentModule. TIA
angular.js:4087 Uncaught Error: [$injector:modulerr] Failed to instantiate
module angularApp due to:
Error: [$injector:modulerr] Failed to instantiate module commentForm 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.
----form with factory injection-----
angular.module('commentForm', ['moment'])
.directive('commentForm', function () {
return {
template: '<form class="commentForm" name="form">' +
'<input type="text" placeholder="Your name"
ng-model="comment.author" name="author"/>' +
'<input type="text" placeholder="Say something..."
ng-model="comment.msg" name="msg"/>' +
'<input type="hidden" ng-model="comment.dateCreated"
name="date" value="{{comment.dateCreated}}"/>' +
'{{comment.dateCreated }}'+
On Monday, April 25, 2016 at 9:28:17 PM UTC-7, Sander Elias wrote:
>
> Your factory is called 'moment', so inject that, and not '$windows.moment'
> .
>
>
>
--
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.