手动将组件引导到现有元素上
Manually bootstrapping a component onto existing element
是否可以手动 bootstrap(插入并编译)Angular2 组件到现有元素上并将属性传递给它。我想做类似下面的事情(在 React 代码中描述):
var Hello = React.createClass({
render: function() {
return <div>Hello {this.props.name}</div>;
}
});
var name = 'World!';
React.render(<Hello name={name} />, document.getElementById('container'));
或者是否有某种替代 $compile?
AFAIK 在 angular2 中没有这样的功能。不过我觉得DynamicComponentLoader is what you are looking for (source code is here).
是否可以手动 bootstrap(插入并编译)Angular2 组件到现有元素上并将属性传递给它。我想做类似下面的事情(在 React 代码中描述):
var Hello = React.createClass({
render: function() {
return <div>Hello {this.props.name}</div>;
}
});
var name = 'World!';
React.render(<Hello name={name} />, document.getElementById('container'));
或者是否有某种替代 $compile?
AFAIK 在 angular2 中没有这样的功能。不过我觉得DynamicComponentLoader is what you are looking for (source code is here).