在较新的示例(seeds,angular.io,..)中,引导过程还有另一个导入:@angular/platform-browser-dynamic
.
有人可以解释一下,它和它之间有什么区别@angular/platform-browser
?
目前还没有关于angular.io官方网站的信息.
我想创建一个组件myApp
,它将在控件的模板中嵌入HTML的属性.但是,某些HTML可能包含其他组件选择器.
import {InfoComponent} from ...
@Component({
selector: 'myApp',
template: `<div [innerHTML]='hData'></div>
<myInfo></myInfo>`,
directives: [InfoComponent]
})
export class AppComponent {
hData = "<myInfo></myInfo>";
}
@Component({
selector: 'myInfo',
template: "<b>This is a test</b>"
})
export class InfoComponent {
}
Run Code Online (Sandbox Code Playgroud)
在这个例子中,我希望看到This is a test
显示两次.但是,似乎Angular2引擎没有注意到Component的选择器已被注入,因此模板永远不会为<myInfo></myInfo>
通过绑定添加的选择器生成.
有没有办法让Angular2解析选择器的方式与在模板中显式添加的选择器相同?
假设我在ng-content标签之间有一个预计的原生输入.我知道,我可以使用@ContentChild获取对预计输入的引用.我想知道如何检测父组件中投影输入元素的焦点事件?