Recently, I've been delving into the ng-cloak source code and trying to understand its inner workings.
If you're interested, you can take a look at the source code here.
From what I gather, it seems that the ng-cloak attribute is removed during the compilation phase of the directive. However, when I attempt to log the HTML content using console.log(element.html())
within the compile function of a directive, I notice that the expressions have not yet been evaluated. This results in an output like:
<my-directive ng-cloak> {{foo}} </my-directive>
My confusion arises from the fact that, since ng-cloak removes the attribute and any associated display:none styling, shouldn't it display the evaluated expression (in this case, {{foo}})? It appears that Angular expressions are not evaluated within the compile function. So, my question now is: When exactly are these expressions evaluated and when does the DOM get updated?