What is the correct way in aurelia to bind on a custom element using repeat.for

大憨熊 提交于 2019-12-01 16:03:46

Browsers only allow li elements inside ul elements. <ul><menu-item></menu-item></ul> is invalid markup in the same way that <ul><div></div></ul> is invalid markup.

Consider making a <menu> element whose template contains the ul and it's li elements instead.

One other thing- only a few standard elements are "self closing"- eg inputs, etc. Custom elements must always have a closing tag. Bad: <menu-item /> Good: <menu-item></menu-item>

You might be wondering "why can't aurelia figure this out for me?"

Valid question. Here's why: Aurelia does not implement a custom html parser. It uses the DOM to parse standard HTML. This is different than other frameworks folks might be accustomed to that implement custom parsers for non-standard markup syntaxes.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!