我正在尝试在一个 HTML 页面中引导多个 angular2 组件。
<body>
<cart id="cart">Loading CartComponent content here ...</cart>
<p>The text between components</p>
<item [itemId]="1" [itemName]="Cool Item1" id="item-1">Loading ItemComponent id=1 content here ...</item>
<p>The text between components</p>
<item [itemId]="2" [itemName]="Cool Item2" id="item-2">Loading ItemComponent id=2 content here ...</item>
<p>The text between components</p>
<item [itemId]="3" [itemName]="Cool Item3" id="item-3">Loading ItemComponent id=3 content here ...</item>
</body>
到目前为止,一切正常,除了从服务器传入 index.html 的属性的属性绑定。
这是 plunker https://plnkr.co/edit/5DbVda?p=preview