Reputation: 21
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
Reputation: 21
My aboslute mistake in my code quoted false as a string "false" that killed me
Upvotes: 1