0
Angular相當新穎,並且將從腳本計算出的值綁定到角度模型以供顯示,因此某些原因我無法展示它。從腳本到角度值的問題綁定值
<!DOCTYPE html>
<html>
<head>
<base href="." />
<title>modern Angular 1 playground</title>
<link rel="stylesheet" href="style.css" />
<script src="https://unpkg.com/[email protected]/dist/system.js"></script>
<script src="config.js"></script>
<script>
System.import('app')
.catch(console.error.bind(console));
</script>
</head>
<body>
<my-app>
loading...
</my-app>
<script>
$scope.localDate = function() {
var currentTime = new Date();
var year = currentTime.getFullYear();
var month = currentTime.getMonth();
var day = currentTime.getDate();
var date = new Date(Date.UTC(year, month, day));
var localDate = date.toLocaleDateString();
return $scope.localDate;
}
console.log(localDate);
</script>
<p ng-model="localDate.localDate">Date = {{localDate}}</p>
</body>
</html>
plnkr鏈接
http://plnkr.co/edit/DOAbtwhIpLxzAJOoCxID