Giter Site home page Giter Site logo

Comments (9)

dgreene1 avatar dgreene1 commented on August 22, 2024 8

Any news on this?

from babel-plugin-angularjs-annotate.

gdaszuta avatar gdaszuta commented on August 22, 2024

@mattbrunetti hi, have you found any way to fix it/work around it?

from babel-plugin-angularjs-annotate.

schmod avatar schmod commented on August 22, 2024

Hooooooboy. I'll have to take a look.

I have not run tests against the presets that include support for async functions. IIRC, we've run into the _x issue before, as Babel's promise to run plugins before presets isn't actually respected in some cases.

from babel-plugin-angularjs-annotate.

schmod avatar schmod commented on August 22, 2024

@gdaszuta @mattbrunetti Just curious: What is your use-case for this. Does Angular even know what to do with an async function?

from babel-plugin-angularjs-annotate.

mattbrunetti avatar mattbrunetti commented on August 22, 2024

@schmod We were trying to use async functions in resolve functions used with angular-ui-router. These functions are called with $injector.invoke() and are expected to return a promise. I don't think Angular's invoke function needs to do anything special with them or even be aware that they're async.

@gdaszuta We determined two workarounds.. (a) avoid using async functions, or (b) separate into two functions: the injected function and the async function. example:

Instead of this ...

resolve: {
  async someResource (someService) {
    'ngInject'
    // ...
  }
}

... do this ...

resolve: {
  someResource (someService) {
    'ngInject'
    return (async () => {
      // ...
    })()
  }
}

from babel-plugin-angularjs-annotate.

LM-G avatar LM-G commented on August 22, 2024

2019, still not working :(

from babel-plugin-angularjs-annotate.

zenflow avatar zenflow commented on August 22, 2024

@LM-G 2019 and you're using Angular 1?

from babel-plugin-angularjs-annotate.

LM-G avatar LM-G commented on August 22, 2024

@zenflow Sadly, yes :( . I just joined an organization which is migrating an old ng1 app to a new fancy one with VueJS.

from babel-plugin-angularjs-annotate.

madflow avatar madflow commented on August 22, 2024

one with VueJS.

Please let us know how that worked out :D

from babel-plugin-angularjs-annotate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.