0
我有一個輸入國家名稱然後覆蓋全局變量的表單。單擊時「提交」按鈕不起作用。我錯過了什麼? 這裏是HTMLAngularjs form not working
<div ng-controller="InputController">
<form class="form-wrapper cf" role="form">
<input type="text" ng-model="model.country" placeholder="Search country..." required>
<button type="submit" ng-click="update()">Search</button>
<span>{{model.country}} ======</span>
</form>
</div>
這裏是控制器。
LastFmApp.controller('InputController',
function InputController($scope) {
$scope.model = {};
$scope.update = function() {
console.log($scope.model.country);
};
});
它似乎工作正常:http://plnkr.co/edit/4j4bJurfxcMPOkXMHIiT?p=preview – JoseM 2014-09-04 16:06:23