javascript - 3 Way Binding in Angular & Firebase causing lag in input boxes -
i binding users profile data variable this:
// profile management var user = firebase.child('users').child(userid); $firebaseobject(user).$bindto($scope, 'user');
here html:
<div ng-show="firebaseuser"> <h1>your profile</h1> <div class="contentcontainer"> <div class="profilepicture"> <img src="images/noprofile.png"> </div> <div class="personalinfo"> <input type="text" ng-model="user.name" ng-change="user.$save()" type="text" label="name" placeholder="your name.." name="username"> <input type="text" ng-model="user.phone" ng-change="user.$save()" type="text" label="phone" placeholder="your phone #.." name="userphone"> <label>email</label> {{firebaseuser.password.email}} </div> </div> </div>
it's working, when type profile, automatically updates firebase database, there severe lag, it's extremely noticeable if type fast lot of words skipped, happens it's un-usable.
what doing wrong?
user this. ng-model-options="{debounce: {'default': 500} }
scope cycle gonna triggered delay 500ms. can adjust fit usage of app. cheer!
<input type="text" ng-model="user.name" ng-change="user.$save()" type="text" ng-model-options="{debounce: {'default': 500} }" label="name" placeholder="your name.." name="username"> <input type="text" ng-model="user.phone" ng-change="user.$save()" type="text" ng-model-options="{debounce: {'default': 500} }" label="phone" placeholder="your phone #.." name="userphone">
Comments
Post a Comment