I fixed it. Instead of scope.date it was comment.date. Thanks anyway,
On Thursday, April 21, 2016 at 2:25:57 PM UTC-7, Janis Rough wrote:
>
> I am not getting a datet with the added hidden date input into my database?
> I put ******* on the places I changed the file.
> I just have to modify the code to add the created date in a date format so
> I can do some calculations but I can't even get the date field. thanks,
> 'use strict';
>
>
> /**
> * @ngdoc directive
> * @name angularApp.directive:commentForm
> * @description
> * # commentForm
> */
> angular.module('commentForm', [])
> .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>'+
>
> '<input type="submit" value="Post"
> ng-click="submitComment()"/>' +
>
> '</form>',
>
> restrict: 'E',
>
> link: function postLink(scope, element, attrs) {
> scope.comment = {};
> scope.date = new Date(); ************
> scope.submitComment = function(){
> var comment = scope.comment;
> 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.