Email validation: Modification doesn't work due to ['ionic'] module run block

I am trying to modify Angular’s built in validation according to the official documentation (https://docs.angularjs.org/guide/forms, pretty at the bottom). They even provide a plunkr: http://plnkr.co/edit/HqFMyiD9z2KA2f2aW56p?p=preview.

However, if I just copy the code into my project, I’m getting “Cannot read property ‘email’ of undefined”. Basically I’m just replacing

`var App = angular.module('form-example-modify-validators', []);` 

with

var App = angular.module('ionicApp', ['ionic', 'firebase', 'ngCordova'])

What am I doing wrong here?

you dont need to change the app module .
just add the directive and use it.

Well this is exactly what’s not working: I added the directive to my var App = angular.module('ionicApp', ['ionic', 'firebase', 'ngCordova']) and it throws the error.

I believe the reason the ionic run block in the module definition. Appears as if it wasn’t firebase. Can anyone confirm this?

hi,
i open a codepen with directive check this out.
make sure you use ionic new beta (14).

http://codepen.io/itamarCohen/pen/QwvweK?editors=101

1 Like

Upgrading to the new beta did the job.
Thanks a lot for that hint and taking the effort to provide a codepen, I really appreciate it!

1 Like