Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular ng-if still run

Trying to figure out ng-if. Why is the alert function executed? Thanks

<div ng-if="false">
    <script> alert("a"); </script>
</div>
like image 234
BlackMouse Avatar asked Feb 26 '26 05:02

BlackMouse


1 Answers

Because the alert() will be executed before angular is loaded. There is no ng-if at this moment

like image 50
trollr Avatar answered Feb 28 '26 22:02

trollr



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!