Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

required working only if placeholder present #149

Open
rolintoucour opened this issue Oct 25, 2016 · 1 comment
Open

required working only if placeholder present #149

rolintoucour opened this issue Oct 25, 2016 · 1 comment

Comments

@rolintoucour
Copy link

I added a ng-required attribute to ng-wig and noticed that, on the first focus on the ng-wig, the input was validated (even if empty).

The problem is that, on $onInit, a '

' is inserted in the model, so the required validation cannot work.

A temporary workaround is to use a placeholder (

isn't inserted this way).

@bampakoa
Copy link
Contributor

The validation does not work because a <p> element is inserted by default if there is no value of the model. I think this is done by design thus you have to control the required behavior in a custom way

For example, if you want to disable a submit button when the editor has no content yet:

<button role="submit" ng-disabled="editor.model === '<p></p>'"></button>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants