1

I need to write a function that uses native async/await in Angular.

Example:

var function = () => {
    var _self = {};

    _self.test = async () => {
        return await someAsyncFunc();
    }

    return _self;
}

When I do ng build --prod the configuration optimizes it and uses zone.js and catch async/await to handle the changes.

Is there a way to avoid this?

Dirty solutions:

  1. Make it a string with `` for example.

  2. Declare some vars and then .toString() and replace with correct syntax before executing it. (Actually in use)

Anyone have a better/clean solution?

Thanks

Smokey Dawson
  • 8,827
  • 19
  • 77
  • 152
Xuty
  • 11
  • 1
  • 3

0 Answers0