我是棱角分明的新人。我试图让用户按下一个按钮,输出应该“点击”。但是,此时它在“hi”输出的初始设置旁边什么也没做。
Java脚本代码(Angular JS):
angular.module("mainModule", [])
.controller("mainController", function ($scope, $http, jsonFilter)
{
$scope.postCall = function () {
$scope.ngResult = "clicked";
};
});
HTML CODE:
<html>
<head>
<link type="text/css" rel="stylesheet" href="json_stylesheet.css"/>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
<script type="text/javascript" src="json_creation_functions.js"></script>
<title>UI for Curl method</title>
</head>
<body onload="processFlow()" ng-app="mainModule">
<div class="sheet_column" ng-controller="mainController" >
<button type="button" value="Submit" ng-click="postCall()"> Submit </button>
<div id="result" >
<label ng-model = "ngResult" ng-init = "ngResult = 'hi'"> {{ngResult}}</label>
</div>
</div>
</body>
</html>