angularjsangularjs-ng-if

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>

Solution

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