I added the required file 'angular moment' and the dependency injected.
Line 12 is the directive line. I have it installed with Bower in the same
directory as the webservice.
Here is the errors in inspector:
commentform.js:12 Uncaught SyntaxError: Unexpected token .
angular.js:80 Uncaught Error: [$injector:modulerr] Failed to instantiate
module angularApp due to:
Error: [$injector:modulerr] Failed to instantiate module commentForm due to:
Error: [$injector:nomod] Module 'commentForm' 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.
/**
* @ngdoc directive
* @name angularApp.directive:commentForm
* @description
* # commentForm
*/
angular.module('commentForm', ['angularMoment']); ****
require('angular-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.date"
name="date" value="{{comment.date}}"/>' +
'<p>{{comment.date}}</p>'+
'<span am-time-ago="message.time"></span>'+
'<input type="submit" value="Post" ng-click="submitComment()"/>' +
'</form>',
restrict: 'E',
link: function postLink(scope, element, attrs) {
scope.comment = {};
scope.submitComment = function(){
var comment = scope.comment;
comment.date = new Date();
if (!comment.msg || !comment.author) {
return;
}
scope.$emit('submitted', comment);
scope.comment = {};
}
}
};
});
--
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.