Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues loading utils script with Angular #1877

Open
MarcoGlauser opened this issue Nov 20, 2024 · 0 comments
Open

Issues loading utils script with Angular #1877

MarcoGlauser opened this issue Nov 20, 2024 · 0 comments

Comments

@MarcoGlauser
Copy link

MarcoGlauser commented Nov 20, 2024

Plugin version

v24.7.0

Steps to reproduce

  1. Add the loadUtilsOnInit option in an Angular project with an import to the options
loadUtilsOnInit: () =>  import('intl-tel-input/build/js/utils.js') 
  1. There is no error but isValid will always be null

Expected behaviour

The utils script should be loaded as expected or an error should be thrown if there was an issue.

Actual behaviour

There is no error thrown in the console.
When attempting to load the utils script with angular, this check fails:

if (!(loadCall instanceof Promise)) {

My guess would be that angular patches the promise, which fails the type check and then the the utils script never gets attached to the instance.

There was no error in the console, which made debugging this quite hard! My guess would be that this line is a bit of an overachiever:

intlTelInput.loadUtils(loadUtilsOnInit)?.catch(() => {});

Thankfully someone reported a similar behaviour in #1597 that set me on the right track.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant