angular.module('angularApp', ['comment','commentList', 'commentForm', 'commentBox', XXXXXXX])
.run(function($rootScope){
$rootScope.comments = [{}];
});
I want to add this 5th directive moment-module for angular moments.I tried adding it as a 5th directive and it can't find the moment-module.angular
.module('moment-module', [])
.factory('moment', function ($window) {
return $window.moment;
});I don't understand where it gets injected into?tnx,
'use strict';
/**
* @ngdoc directive
* @name angularApp.directive:moment-module
* @description
* # moment-module
*/
angular
.module('moment-module', [])
.factory('moment', function ($window) {
return $window.moment;
});
angular
.module('momentModule', [])
.factory('moment', function ($window) {
return $window.moment;
});
----my form-----
angular.module('commentForm', ['$window.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 }}'+
// '<input type="hidden" ng-model="comment.dateCreated" name="date" value="{{this.window = $window.moment}}"/>' +
'{{comment.dateCreated }}'+
// '<input type="hidden" ng-model="comment.dateCreated" name="date" />' +
'<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.dateCreated = new Date();
if (!comment.msg || !comment.author) {
return;
}
scope.$emit('submitted', comment);
scope.comment = {};
}
}
};
});