I'm adding classes using ng-class
, but when I try to find this element starting from a directive, I can not find them.
Link to a plunker with example code: link
.directive('step1', function(loadTemplate) {
return {
link: function(scope, el, attrs) {
console.log(el.find('.step.disabled'));
}
}
})
Chrome console output:
context: div
length: 0
prevObject: o.fn.init[1]
selector: ".step.disabled"
__proto__: Object[0]
processes / steps / step1.html:
<div>
<div toggle-box>
<div class="step" ng-class="{enabled: condition, disabled: !condition}">
...
When I try to find the elements with only $('.step')
I can find them, since the class is already there from the beginning (see plunker).
How can I resolve this?