-1

I am trying to increase the performance of my web page in chrome Audit.I added 'async' to my script tag as follows,

<body ng-cloak id="body">
   <script
    src="https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=geometry,places&sensor=false&key=AIzaSyBMxfoPEGblWmG-R6eLz6Oe0FS6wPEnMNA"
    async></script><!-- bower:js -->
   <script src="vendor/app.deps.js" async></script><!-- endinject -->
   <script>angular.module('templates', []);</script><!-- inject:js -->
   <script src="js/app-1591858972321.js" async></script>
   <script src="js/partials.min.js" async></script><!-- endinject -->

</body>

I am getting the following error when it is loaded,

angular is not defined in 'js/app-1591858972321.js'
angular is not defined in 'js/partials.min.js'

Can anyone please suggest me to resolve these error.Thanks.

learner
  • 357
  • 1
  • 6
  • 16

1 Answers1

0

The angular scripts have to load in a defined order. The vendors needs to ne loaded before your Script. Async destroys the order. Try its with defer instand of async Any way to control Javascript Async Load Order?