与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说 –