Mpondomise Mpondomise - 1 year ago 69
AngularJS Question

angularjs ng-hide element based on firebase mode

Refering to this documentation here, I am trying to hide my element if the

in the controller function is
No success.
Could somebody help to see why it doesn't work?

my html is like:

<div class="box-forgot" ng-controller="ResetPass">
<form class="form-forgot" name="resetpassword" ng-hide="mode == 'verifyEmail'">
Reset Password:

<div class="form-group">
<span class="input-icon">
<input type="password" class="form-control" id="password" ng-model="user.password" name="password" placeholder="Password" required="">
<i class="fa fa-lock"></i> </span>

<div class="form-actions">
<button type="submit" class="btn btn-primary pull-right" ng-click="resetMe()">

and the corresponding controller is:

app.controller("ResetPass", ["$scope","firebase", "$location",
function ($scope,firebase, $location) {

$scope.resetMe = function () {
var newPassword = $scope.user.password;
var actionCode = $;
var mode = $;
firebase.auth().confirmPasswordReset(actionCode, newPassword)
.then(function (resp) {
console.log("reset pass, done");
}).catch(function (error) {
$scope.errMsg = true;
$scope.errorMessage = error.message;

Answer Source

Try to bind mode with $scope object instead of var

Instead of

    var mode = $;

Do this

    $scope.mode = $;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download