In my AngularJS app, I want to pass input field's value to controller when button is clicked. What I am doing for that is posted below but it's not working. So please guide what is the issue?
index.html
<input type="text" ng-model="searchKey"> <button type="button" ng-click="loadSearch(searchKey)">Search</button>
myCtrl.js
app.controller('myCtrl', function($scope, $http) { function loadSearch(key) { alert(key); } });
#angular.js