Hello all! I have put hours googling on this but I just cannot understand what is going on. I need help. Thanks for reading:
I have a simple profile form that gets prepopulated when the view loads, the interesting part:
Name: <input type='text' ng-model="profileedit_name">
<button ng-click="doSaveProfileEdit()" >Save</button>
Now, the input boxes get prepopulated when the view loads, like this:
var responsePromise = $http({
method: 'POST',
url: 'ajax/get_profile.php',
data: "userid=" + 0,
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
});
responsePromise.success(function(data, status, headers, config) {
$scope.profileedit_name = data['name'];
});
This code sucessfully fetches the data (json array with name + more things) and puts it in the input/textareas.
I then manually edit (I click+type) on the NAME input field and change “Bob” to “Anastasia”
Then, using the button at the top this code runs:
$scope.doSaveProfileEdit = function() {
alert($scope.profileedit_name);
}
In turn, that code is suposed to send the values to the server, but it sends the OLD “Bob” data which is no where to be seen in the view! The alert also shows “Bob”. If I manually edit the value just before the alert with:
$scope.profileedit_name = 'foo';
Then the alert goes “foo” as one would expect.
This is not working on desktop Firefox browser, stock safari on iPhone5 and stock browser on SamsunGalaxy S3 mini.
What is happening? Any help is very MUCH appreciated.
Ionic is 1.0.0-beta.4