mikeerickson / validatorjs

A data validation library in JavaScript for the browser and Node.js, inspired by Laravel's Validator.
https://www.npmjs.com/package/validatorjs
MIT License
1.77k stars 280 forks source link

Validator is not available during Angular testing #151

Closed apmeena closed 7 years ago

apmeena commented 7 years ago

@skaterdav85, I am using validatorjs with Angular js, The application is working fine as expected, but during testing Validator is not defined error I am facing. Because in Angular js we need to inject each and every plugin or library we are using in our module and controller. But we are not injecting here we are directly using:

var validation = new Validator(data, rules [, customErrorMessages]);

So inside all the controllers it is available globally, but how can I access it as a service or a factory?

iamdtang commented 7 years ago

Access it globally in the service or factory.

apmeena commented 7 years ago

But we don't have access in testing. What can I do for it?

iamdtang commented 7 years ago

Is it getting loaded in your test harness?