<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
<script src="libs/angular.min.js"></script> | |
<script> | |
var app= angular.module("gaoyn",[]); | |
//使用的功能,需要 | |
app.factory("gaoynsowTime",["$filter", function($filter){ | |
var fdate=$filter("date");//获取过滤器---->日期过滤器 | |
var now=new Date(); | |
return fdate(now,'yyyy-MM-dd hh:mm:ss') | |
}]); | |
app.controller("democ",["$scope","gaoynsowTime",function($scope,gaoynsowTime){ | |
$scope.now=gaoynsowTime; | |
console.log("当前时间",$scope.now); | |
}]); | |
</script> | |
</head> | |
<body ng-app="gaoyn" ng-controller="democ"> | |
{{now}} | |
</body> | |
</html> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
<script src="libs/angular.min.js"></script> | |
<script> | |
var app= angular.module("gaoyn",[]); | |
//使用的功能,需要 | |
app.factory("gaoynsowTime",["$filter", function($filter){ | |
var fdate=$filter("date");//获取过滤器---->日期过滤器 | |
var now=new Date(); | |
return fdate(now,'yyyy-MM-dd hh:mm:ss') | |
}]); | |
app.controller("democ",["$scope","gaoynsowTime",function($scope,gaoynsowTime){ | |
$scope.now=gaoynsowTime; | |
console.log("当前时间",$scope.now); | |
}]); | |
</script> | |
</head> | |
<body ng-app="gaoyn" ng-controller="democ"> | |
{{now}} | |
</body> | |
</html> | |