Angularjs: ng-model setting value from controller
Angularjs: ng-model setting value from controller how to set value of ng-model with dot from controller? <input type=text" ng-model="user.latitude"> this doesn't work: $scope.user.latitude = myLat; use $scope.user = {latitude: myLat}; in your controller – guru Jun 4 '14 at 15:24 3 Answers 3 You need to create user object first: user $scope.user = {}; $scope.user.latitude = myLat; or shorter: $scope.user = {latitude: myLat}; yes, but this will clear other values of user, for example 'ng-model="user.name"', how to edit only 'user.latitude'? – user1824542 Jun 4 '14 at 15:35 ...