我有以下代码,但是当我按下提交时没有任何反应
<html ng-app>
<head>
<script src="http://code.angularjs.org/1.2.0rc1/angular.min.js"></script>
</head>
<body>
<form ng-submit="submit()" ng-controller="Ctrl">
Enter text and hit enter:
<input type="text" ng-model="text" name="text" />
<input type="submit" id="submit" value="Submit" />
</form>
<script>
function Ctrl($scope) {
var str = $scope.text;
var ret = {};
for(x = 0, length = str.length; x < length; x++) {
var l = str.charAt(x);
ret[l] = (isNaN(ret[l]) ? 1 : ret[l] + 1);
}
for(key in ret) {
alert(key + ' :: ' + ret[key]);
}
}
</script>
</body>
</html>
我做错了什么?