Closed asermax closed 5 years ago
Actually, I found out that it's working correctly on other templates, so it seems something specific to that template. It's really strange since img src='{{ unbound model.coverImage }}'
works correctly, which is supposedly equivalent to what the shorthand does.
@asermax I wonder if Emblem is compiling in the "!" rather than making it an unbound property. I'll investigate this.
@asermax You can use the try emblem site to see how Emblem will deal with different strings.
img src=model.coverImage!
=> <img src="{{unbound coverImage}}">
, which seems like it should be working.
You can try pasting in your entire template to the "try emblem" site linked above to see if that helps diagnose the issue.
Nice, that web makes debugging the template a lot easier, thanks.
Looks like the issue is that the generated Handlebars template doesn't respect the full path to the property, it only takes the last part of the path into account. For example img src=model.foo.bar.coverImage!
generates <img src="{{unbound coverImage}}">
too, making the issue more obvious.
Using the shorthand outside a html property works correctly tho: h3 = model.coverImage!
outputs <h3>{{unbound model.coverImage}}</h3>
.
My particular issue came up because for that specific template there was a simple Controller
backing it up (we started migrating our controllers given the upcoming ObjectController
deprecation), while the other templates where it did work, didn't have a explicit controller, so Ember was autogenerating a ObjectController
which proxied the property to the model even if emblem ignored the rest of the path.
Hope this helps fix the issue.
@asermax Yes, thank you, I missed that before. I've added a sample failing test in 835c94e, will take a look at this later on.
Used to have
img src=model.coverImage!
on anemblem
template, but after started usingember-cli-emblem-hbs-printer
it stopped working.I was also using the shorthand in some other places (literally everywhere I wanted some unbound values) and the previous version seemed happy to complain, though now that I went through the syntax documentation again it aparently is only valid within HTML attributes.
Is the shorthand no longer valid?