I am trying to format date using moment in Angularjs but its not working for me. Here is my fiddle http://jsfiddle.net/sed6x5e8/ and below is my code.
HTML:
<div ng-app="miniapp">
<div ng-controller="Ctrl">
<div>
Actual Date: {{date}}
<br><br>
Formatted Date: {{formattedDate}}
</div>
</div>
</div>
JS:
var $scope;
var app = angular.module('miniapp', [])
function Ctrl($scope) {
$scope.date = '2/13/2015';
$scope.formattedDate = moment($scope.date).format('YYYY-MM-DD');
}
var $scopeoutside your controller? And you have en error in the console,momentisn't included.momentlibrary to your project - jsfiddle.net/sed6x5e8/1