Open dustinblanchard opened 7 years ago
With latest angular/ng2-validation importing Phone validator throws error:
<input phone="CN" ...>
XHR error (404 Not Found) loading http://localhost:3000/libphonenumber-js
Versions:
"@angular/core": "~4.0.0",
"@angular/forms": "~4.0.0",
"ng2-validation": "^4.1.0",
When updating ng2-validation from 3.9.1 I am getting the same error @latobibor described.
Error: (SystemJS) XHR error (404 Not Found) loading http://localhost/accounts_payable/libphonenumber-js
Versions:
"@angular/core": "^4.0.2",
"@angular/forms": "^4.0.2",
"ng2-validation": "^4.1.0",
I get the same 404 error when I try the latest 4.2.0 version.
Versions:
` "@angular/core": "~2.4.0", "@angular/forms": "~2.4.0", "ng2-validation": "^4.2.0", `
I can also confirm that when i downgraded to the version mentioned above (3.9.1), it starts working.
@mgroetan you can resolve this by installing libphonenumber-js
install it using npm install libphonenumber-js --save
or add "libphonenumber-js": "^0.4.18"
to your package.json
@dhniels That doesn't help at all - same error. You see, when I installed the validation package, it downloaded the phone number package as well. I could very well see the folder/files within "node_modules". When I install "libphonenumber-js" manually as you suggest, it effectively doesn't do anything (other than add it to "package.json"), as the package has already been downloaded.
Log from install of "ng2-validation" (backticks replaced with apostrophes):
`'-- ng2-validation@4.2.0 '-- libphonenumber-js@0.4.18 +-- babel-runtime@6.23.0 |'-- regenerator-runtime@0.10.5 +-- minimist@1.2.0 '-- xml2js@0.4.17 '-- xmlbuilder@4.2.1`
@mgroetan Hm, not sure then. I had the same error and assumed since the new version was requiring this dependency that installing it would resolve the error (which it did) so its now working for me. You must have something else going on. I wonder if upgrading your angular to version 4 would resolve it? Sorry that wasn't more useful. Hopefully the author will see this issue and respond with a definitive answer since its been open a while.
Here we install libphonenumber as a dependency in the project too, maybe this can help u
I add this mapping for system.config.js:
'libphonenumber-js' : 'npm:libphonenumber-js/bundle/libphonenumber-js.min.js'
and it helps
Oh yeah @mgroetan that could've been your problem. i forgot to add that. you do indeed need to add it to your systemjs config, see above comment
It would be awesome to see google's libphonenumber included for phone validation. The AsYouTypeFormatter would be really great to have here.