user6579134 user6579134 - 1 year ago 98
AngularJS Question

place localstorage value in a textbox from a controller with angularjs

I have a localstorage value which i would want to put in it a texfield from a controller

.controller('working_ctrl', ['$scope', '$http', '$location', function ($scope, $http,$location) {
$scope.user= localStorage.getItem("user")
$scope.items = [];
$scope.selected = undefined;
method: 'GET',
}).then(function (data) {
$scope.items =;



<div ng-controller="working_ctrl" ng-repeat="s in items| limitTo:1">
<input name="quantity" type="text" id="quantity" ng-model="s.quantity">
<input name="user" type="text" id="user" ng-model="s.user">

Answer Source

You can bind the $scope.user to that textbox

<input name="user" type="text" id="user" ng-model="user">
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download