Skip to content Skip to sidebar Skip to footer

Why Won't This From Scope Variable At Angular Js Controller Is Set To True?

I'm trying to code a controller so some inputs get disabled after changes in another one. This is the controllre: app.controller('SignUpController',function ($scope, $http) {

Solution 1:

Try this:

app.controller('SignUpController',function ($scope, $http) {
var that = this;
    that.unavaliable = true;

    that.userUnavaliable = function() {  
        console.log(that.unavaliable)
        return that.unavaliable
    }

    that.userExists = function(mail) {...

Your issue seems to be related to JS Context; in the example above it is preserved in that variable. That is how it is done in JOhn's Papa approach

Post a Comment for "Why Won't This From Scope Variable At Angular Js Controller Is Set To True?"