I'm trying to conditionally include a chat on my page:
<body ng-app="myApp">
<!-- some code -->
<script type="text/javascript" ng-if="expression">
window.$zopim||(function(d,s){var z=$zopim=function(c){z._.push(c)},$=z.s=
d.createElement(s),e=d.getElementsByTagName(s)[0];z.set=function(o){z.set.
_.push(o)};z._=[];z.set._=[];$.async=!0;$.setAttribute("charset","utf-8");
$.src="//v2.zopim.com/?my-zopim-id";z.t=+new Date;$.
type="text/javascript";e.parentNode.insertBefore($,e)})(document,"script");
</script>
</body>
but it seems that the chat script gets executed before ng-if directive.
How can I make my Angular app to check the condition first and then execute the script from <script> tag?
<div ng-if="condition" ng-include="file/with/javascript/code.html"></div>