I'm implementing angular js and is trying to get the input box's value and store it into the local storage. The input is typed by user and it's refer to 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 my js code:
.controller('Ctrl', function($scope) {
$scope.save= function() {
console.log($scope.serverip);
localStorage.setItem('serverip', $scope.serverip);
};
})
Why is it by using the above coding, after I key in the ip address into the input box, the $scope.serverip I get is always undefine?