本文整理汇总了TypeScript中angular2/core.Renderer.selectRootElement方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Renderer.selectRootElement方法的具体用法?TypeScript Renderer.selectRootElement怎么用?TypeScript Renderer.selectRootElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类angular2/core.Renderer
的用法示例。
在下文中一共展示了Renderer.selectRootElement方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: createChild
createChild() {
if(this.element === null)
this.element = this.renderer.selectRootElement('.dynamic-container');
console.log('selected element: ', this.element);
this.element = this.renderer.createElement(this.element, 'div'); //this will replace all content of element
this.renderer.setElementStyle(this.element, 'padding-left', '15px');
this.renderer.createText(this.element, 'created by renderer');
}
示例2: showMap
showMap() {
// Create a map object and specify the DOM element for display.
var targetEle = this._renderer.selectRootElement(".map");
var map = new google.maps.Map(targetEle, {
center: { lat: 37.3275, lng: -122.1419 },
scrollwheel: false,
zoom: 8
});
this.devices.forEach(device => {
var batteryStyle = this.calculateBatteryStyle(device.BatteryLevel);
var infoContent = `
<h1>Information</h1>
<table class="table table-striped table-hover table-bordered">
<tr><td><b>ID</b></td><td>${device.ID}</td></tr>
<tr><td><b>Firmware Version</b></td><td>${device.FirmwareVersion}</td></tr>
<tr><td><b>Software Version</b></td><td>${device.HardwareVersion}</td></tr>
<tr>
<td><b>Battery Level</b></td>
<td><span class="label label-${batteryStyle}">${device.BatteryLevel}</span></td>
</tr>
</table>
`;
var infowindow = new google.maps.InfoWindow({
content: infoContent
});
var marker = new google.maps.Marker({
position: { lat: device.LAT, lng: device.LON },
map: map,
title: 'Hello World!'
});
marker.addListener('click', function() {
infowindow.open(map, marker);
});
});
}
示例3: frame
frame(selector?: string) {
this.root = this._renderer.selectRootElement(selector);
}
示例4: ngOnInit
ngOnInit() {
let root: any = this._renderer.selectRootElement('renderer-root');
this._renderer.setText(root, "Render demo.");
}