Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

IE11: button type with interpolated value is ignored #14117

Closed
cudasteve opened this issue Feb 23, 2016 · 3 comments
Closed

IE11: button type with interpolated value is ignored #14117

cudasteve opened this issue Feb 23, 2016 · 3 comments

Comments

@cudasteve
Copy link

  • Do you want to request a feature or report a bug?

Bug (with workaround). Though I couldn't find any info on this behavior on the internet and it seems like it'd be an important "gotcha" for a lot of people that should really be documented somewhere.

  • What is the current behavior?

Using <button type="{{someInterpolatedThing}}"> doesn't seem to play nicely with IE11 (didn't test past versions). It sets the type to submit regardless of what the interpolated value comes out to.

  • Steps to reproduce and if possible a minimal demo of the problem

Here's a pen showing the behavior. Open in Chrome, you get button type of button. Open in IE11, you get button type of submit.

Workaround: Using ng-attr-type="{{someInterpolatedThing}}" fixes it. I guess if this is the only way to workaround it, it might be useful having this as an additional example in the ngAttr docs since the canonical one there right now is <circle cx> which makes it seem like it might be primarily for svg.

  • What is the expected behavior?

IE11 interpolates the value and sets the type of the button

  • What is the motivation / use case for changing the behavior?

Cross-browser consistency (if possible) or at least let people know about it in the docs (if not possible)

  • Which version of Angular, and which browser and OS does this issue affect? Did this work in previous
    versions of Angular? Please also test with the latest stable ánd snapshot versions.

1.5.0 on IE11

  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix)
@gkalpak
Copy link
Member

gkalpak commented Feb 23, 2016

I verify that this happens on IE11. I don't think Angular can do much, because IE11 sets the value for the type attribute to submit, before Angular has a chance to access the interpolated expression. So Angular never sees type="{{ someExpression }}", it just sees type="submit".

So, pointing it out in the docs is the only thing we can do. We should add it here, were the similar issue with style is mentioned.

@cudasteve, would you like to submit a PR ?

@cudasteve
Copy link
Author

Sure thing

@cudasteve
Copy link
Author

Submitted a PR under my personal account

SteveShaffer added a commit to SteveShaffer/angular.js that referenced this issue Feb 24, 2016
SteveShaffer added a commit to SteveShaffer/angular.js that referenced this issue Feb 24, 2016
petebacondarwin pushed a commit that referenced this issue Feb 24, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants