<input type = "email"> breaks the ng model data binding in the modal dialog
My application is using a modal dialog with a simple input element
<input id="fieldEmail" class="form-control" type="text" ng-model="email" required="" />
email: {{ email }}
While the modality is showing, I can enter something in the input field and see how it is reflected in the text next to it, as expected. But if I change the input type to type = "email" it breaks the data binding. Login is no longer reflected.
Has anyone else encountered this problem?
source to share
This is because of the "email" type. Even if we use type = 'number' then 'ng-model' will be undefined as well, unless you enter some valid number in the text field. For all HTML5 input types, we have to provide valid inputs to assign a value to the ng model. And even when we use regular expressions for text fields, the ng model will be undefined until we supply a value that matches the regular expression.
' http://plnkr.co/edit/G2RlzO4q1zKEPP0T8xvF?p=preview `
<body>
<h1>Hello Plunker!</h1>
Enter 3 to 12 characters only.
<br/>
<input type="text" ng-model="name" ng-pattern="/^[a-z]{3,12}$/"/>
<br/>
{{name}}