Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49103

Just can't seem to wrap my head around $scope variables and how they work!

$
0
0

@rgecy wrote:

I am having a hard time understanding $scope variables. I have an input field with ng-model='firstName" and a $scope variable of $scope.firstName. In my controller I set $scope.firstName = $rootScope.currentUser.firstName.

My problem is that if the user changes firstName in the input field, not only does $scope.firstName change but it also changes $rootScope.currentUser.firstName.

How can I keep this from happening? I only want to update $rootScope.currentUser.firstName if the user clicks the SAVE button.

Posts: 6

Participants: 4

Read full topic


Viewing all articles
Browse latest Browse all 49103

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>