user5610012
user5610012

Reputation: 21

has-error with ngClass on load even the expression is false it loads the class

Trying to load boot strap has-error class using ng-class with condition on a variable injected to controller from my factory ,though the initial value of variable is false , the has-error loads up and my fields are shown to have error

html :

<div ng-class="{'has-error' : variable.var1 }">

{{var1}} - printing this expression to see the value on the view

when the app loads {{var1}} shows as false on view

yet has-error is active and my input fields are highlighted in red

Controller :

myApp.controller('SpicyController', ['$scope','factroy1' function($scope,factroy1) {

     $scope.variable = factroy1;    


    };


}]);

myApp.factory('factroy1',function(){

    var variable={}
    variable.var1=false;

    return variable;

});

Upvotes: 1

Views: 69

Answers (1)

user5610012
user5610012

Reputation: 21

My aboslute mistake in my code quoted false as a string "false" that killed me

Upvotes: 1

Related Questions