本文整理匯總了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.");
}