現在の日付と時刻がnew Date.getTime()
すべてのユーザーによる新しい投稿ごとに日付と時刻がスタンプされ、投稿の内容と一緒に保存されるように実装するにはどうすればよいですか?
var timestamp = new Date.getTime()
それとも?$scope.timestamp = new Date.getTime()
_ ng-click=submitPost() でフォームが送信されたときに、日付を配列に保存するにはどうすればよいですか?
以下を挿入して、各エントリに日付と時刻をマークしました。サブミット ポスト コントローラー内:
$scope.post = {url: 'http://', title: '', timestamp: new Date()};
そしてhtmlで
{{post.timestamp}}
エントリへのタイムスタンプ コメントの更新:
$scope.addComment = function () {
var comment = {
text: $scope.commentText,
creator: $scope.user.profile.username,
creatorUID: $scope.user.uid,
timestamp: new Date().toUTCString() //I added it here but doesnt work
};
$scope.comments.$add(comment);
$scope.commentText = '';
};