Emberjs如何绑定-attr一个id

我想使用ember属性通过调用它的动态id来切换div的可见性,但是即使我可以通过调用类来做类似的事情,我也不能对id做同样的事情。

例如: {{bind-attr class=":class1 controller.controllerProperty:class2"}}工作正常。 我可以从controllerProperty中的动作切换controllerProperty。

你会认为同样的概念适用于id。 但是{{bind-attr id=":staticId controllerProperty:id{{dynamicIdNumber}}"}}使得id一起消失!

为什么会发生这种情况?这种方法的正确方法是什么? 我想尽可能避免使用解决方案。

绑定到类是Ember中的一个特例,如此处所述。 此处描述了将其他属性绑定到属性