Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Submit button with ng-if #42

Open
cmolina opened this issue Apr 18, 2017 · 1 comment
Open

Submit button with ng-if #42

cmolina opened this issue Apr 18, 2017 · 1 comment

Comments

@cmolina
Copy link

cmolina commented Apr 18, 2017

I have a form like this

<form ng-submit="yourServiceCaller()"
      promise-btn>
  <button type="submit" ng-if="maybe">MyBtn</button>
</form>

By debugging, I found that getSubmitBtnChildren does not find buttons with the ng-if directive.

A workaround is to use ng-show instead. Is there any way to wait until all those ng-if are already resolved?

@johannesjo
Copy link
Owner

johannesjo commented Apr 19, 2017

Thanks for digging into this. As it is currently implemented the button needs to be present in the dom once the promise-btn directive (in this case on the form element) is $compiled.

Currently there is also no easy way to set this up as the button elements need event handlers to be attached. Listening for dom changes inside of the form would be complicated and costly performancewise, but I'm open to suggestions!

One alternative would be to use a child directive on the buttons, but this would require a huge refactor of the component, make the usage more complicated and possibly break existing implementations.

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

No branches or pull requests

2 participants