-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
2.1: <a href={{condition}}>
results in <a href="null">
after condition
was dynamically set to null
#12358
Comments
@lolmaus I guess the work around is to use an if/else rather than the condition for this use case. Seems like the attr is bound by default and the condition determines the value of the attribute. I'm not sure if the first rendering is just fixed by the browser or by the JS. but it appears in your example that mucking with the value breaks and shows an empty If you want the |
@pixelhandler the |
It seems to work for attributes other than href: http://emberjs.jsbin.com/leyehe/edit?html,js,output So href is definitely bugged. |
@lolmaus I meant using the if / else in your template instead of relying on a conditional in the value assignment to the html attribute {{#if hasURL}}
<a href="{{url}}">GO</a>
{{else}}
<a>WAT</a>
{{/if}} Seems like a gamble to expect the value assignment to the attribute to indicate whether or not the attribute should present and empty, missing, or to be present with a value - and the expected browsers to behave accordingly. |
I suspect this may be related to |
@pixelhandler That would result in code duplication. It gets really burdensome when your link content is complex. |
@lolmaus this issue has been inactive for some time, do you still have this issue? |
I don't think so. Will repoen if I run into this again or someone reports it. |
So you've got this in your template:
condition
isnull
, and it correctly renders to<a>
.But then you change
condition
dynamically.When
condition
isnull
again, it renders as<a href="null">
.Demo (thx to @alexspeller): http://ember-twiddle.com/a0a8088d67b451817902
The text was updated successfully, but these errors were encountered: