I have an input box that has an ng-pattern on it for basic link validation. Our PM wants us to have the 'http://' text already in the input before the user starts editing it...however i can't just put this text there as it breaks the ng-pattern validation and thus, doesn't show up.
<input type="text" ng-model="$parent.emailData.setting.button[2].link"
name="button2link"
ng-class="{invalid: step3Form.button2link.$invalid}"
ng-pattern="link_pattern"/>
For reference, link_pattern is defined as
$rootScope.link_pattern = /(https?:\/\/)(www)?[A-Za-z0-9.\-@_~]+\.[A-Za-z]{2,}(:[0-9]{2,5})?(\/[A-Za-z0-9\/_\-.~?&=]*)*/
I'm rephrasing my question for clarification (it's isn't the styles I'm worried about, that already works) Is there a way for me to have real text (not placeholder) 'http://' in my input field and still have the link pattern validation
When the user sees the input box, i want the text 'http://' to be there (right now it's just a placeholder) so they don't have to type it themselves.
Aucun commentaire:
Enregistrer un commentaire