I have an element that I am displaying on the web page - this element is a twitter bootstrap icon -
<i class="icon-trash"></i>
.
When the page loads, the icon is hidden by applying the hidden class to it with the style:
.hidden {
display: none;
}
Now, I have created a directive which in its simplest form looks like:
var app = angular.module('testApp', []);
app.directive('testDir', function() {
return function(scope, iElement, iAttrs) {
iElement.customMethod({
source: function() {
//Some other statements
jQuery(".icon-trash").removeClass('hidden');
}
});
};
});
This directive is placed on an input box as an attribute. When the user enters an input text, the directive function is indeed called. However, the icon is never displayed again, that is the jQuery code does not seem to remove the hidden class even though the function is called (checked using console.log()
). Any idea why?