I am encountering an issue with a form that takes input for the name of a country and should update a global variable. However, when the submit button is clicked, nothing happens. Can someone point out where I am going wrong? Below is the HTML code snippet:
<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>
Here is the corresponding controller code:
LastFmApp.controller('InputController',
function InputController($scope) {
$scope.model = {};
$scope.update = function() {
console.log($scope.model.country);
};
});