I am implementing angular js and trying to get the value of an input field and store it in local storage. The input is entered by the user, and he refers to the ip-address.
Below is my html code:
<div> <input ng-model="serverip"> <input type="button" class="button" value="Apply" ng-click="save()"> </div>
Below is the js code:
.controller('Ctrl', function($scope) { $scope.save= function() { console.log($scope.serverip); localStorage.setItem('serverip', $scope.serverip); }; })
Why is this, using the above encoding, after I enter the ip address in the input field, $scope.serverip , I always get undefined?
source share