I am currently working on developing a controller function to handle signup submissions using Firebase. However, I've encountered an issue where the variables within the scope (controllerAs: $reg
) do not seem to update correctly when modified inside a promise.
Whenever $reg.loading
is set to true, it reflects accurately in the template. But, if changed to false, the scope variable updates in the controller, yet the template fails to recognize this change.
$reg.submit = () => {
$reg.loading = true;
firebase.auth().createUserWithEmailAndPassword($reg.user.email, $reg.user.password)
.catch(error => {
$reg.loading = false;
});
};
The template essentially consists of a form that triggers the $reg.submit()
function upon clicking the submit button (tested with both ng-submit and ng-click).