When I set $scope.newStore1 = 'Owl Store'; and use {{newStore1}} in my code, the text on the page correctly displays Owl Store upon loading. Data binding is working fine here. However, when I create an input box with the model newStoreName, things get a bit tricky...
{{newStore1}}
<form data-ng-submit="storeUpdate()">
<input type="text" ng-model="newStore1">
<input type="submit" />
</form>
Even though as I type in the text box, the {{newStore}} updates with the text, the new store name shows up as null. Strangely enough, it works fine in the HTML but gives a null value in the JavaScript function below.
$scope.storeUpdate = function() {
Users.get({email:$scope.global.user.email}, function(user3) {
user3[0].store.push($scope.newStore1); // $scope.newStore1 is working in html but is 'null' here
user3[0].$update(function(response) {
Users.query({}, function(users) {
$scope.users = users;
$scope.global.user = response;
});
});
});
};