국가의 이름을 입력 한 다음 글로벌 변수를 덮어 쓰는 양식이 있습니다. 제출 단추는 클릭 할 때 아무 것도하지 않습니다. 나는 어디에서 실종 되었습니까? 다음은 HTML입니다Angularjs 양식이 작동하지 않습니다.
<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