與AngularJS顯示數據時,按下一個按鈕是簡單的例子AngularJS
<!DOCTYPE html>
<html ng-app>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script>
<script>
function Display($scope){
$scope.show_date = function(){
$scope.show=new Date();
}
}
</script>
</head>
<body ng-controller="Display">
<button ng-click="show_date()">Show date!</button>
<div ng-message="required"> {{show}} </div>
</body>
</html>
我哪裏錯了在此代碼的例子嗎?
你的控制器的聲明使用過時的語法 – tymeJV
什麼是閱讀文檔,看到的基本問題? –
你可以參考[這個答案](http://stackoverflow.com/a/28728380/2435473),你只是按照舊的方式做它像@tymeJV說 –