You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Hi,
I'm not sure it's an issue, but I think. Let me explain, when using ng-if in the template of a directive, and then in the link method trying to select the element the object return is empty, even if the element exists by passing the ng-if validation. Of course no problem if using ng-show.
This is how ngIf works (i.e. how all directives with transclude: '$element' work).
At the time you are trying to find your template element, there is only a placeholder comment-node in the DOM. The actual template is inserted at a later time.
E.g. if you wrap the code inside of a $timeout() you will be able to inspect the element normally.
That said, this is a general support question and as such should have been directed to the appropriate channels.
GitHub is reserved for bug reports and feature requests.
Thanks for your answer and sorry for the mistake, I thought it was maybe a bug related to other already on GitHub with Directives and ngId + TemplateUrl like : #7183 or #9837.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi,
I'm not sure it's an issue, but I think. Let me explain, when using ng-if in the template of a directive, and then in the link method trying to select the element the object return is empty, even if the element exists by passing the ng-if validation. Of course no problem if using ng-show.
An example here : http://plnkr.co/edit/8vBzoL640k3j7U3GW04T?p=preview
Try to modify the plunker by changing ng-if to ng-show and the element is logged in the console.
I hope it's just me missing something.
Thanks !
The text was updated successfully, but these errors were encountered: