本文整理汇总了TypeScript中@angular/core.Renderer.setElementProperty方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Renderer.setElementProperty方法的具体用法?TypeScript Renderer.setElementProperty怎么用?TypeScript Renderer.setElementProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/core.Renderer
的用法示例。
在下文中一共展示了Renderer.setElementProperty方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: ngOnInit
ngOnInit() {
if (typeof this.classToApply === 'undefined') {
this.classToApply = '';
}
if (typeof this.search === 'undefined') {
this.renderer.setElementProperty(this.el.nativeElement, 'innerHTML', this.text);
return;
}
let search = escapeStringRegexp(this.search.toString());
this.renderer.setElementProperty(this.el.nativeElement, 'innerHTML', this.replace(this.text, search));
}
示例2: selectedOptions
selectedOptions() {
let selections: HTMLCollection = this.select.nativeElement.selectedOptions;
while (selections.length > 3) {
this.renderer.setElementProperty(_.last(selections), 'selected', false);
}
this.getSymbols(_.map(selections, (option: HTMLOptionElement) => option.value));
}
示例3: disableElement
disableElement(){
if (this.el.nativeElement.tagName === 'INPUT'){
this.renderer.setElementProperty(this.el.nativeElement, 'disabled', true);
}
if (this.el.nativeElement.tagName === 'DIV'){
this.el.nativeElement.style.display = 'none';
}
}
示例4: _highlight
private _highlight(color: string) {
this.renderer.setElementProperty( this._el.style, 'backgroundColor', color)
// XSS security issue example
let val = "<script>console.log('XSS injection')</script>"
// val = this.sanitizer.sanitize(SecurityContext.HTML, val)
// this.renderer.setElementProperty( this._el, 'innerHTML', val)
this._el.innerHTML = val
}
示例5: constructor
constructor(private router: Router, eRef: ElementRef, renderer: Renderer, seo: PageTitleService) {
let parent = eRef.nativeElement.parent;
let styleElement = renderer.createElement(parent, "style");
renderer.setElementProperty(styleElement, "type", "text/css");
renderer.setText(styleElement, mainCss);
seo.setTitle("Angular-Meteor - realtime full stack JavaScript development");
seo.setBasePath(global['basePath'] || '/');
}
示例6: doTranslate
private doTranslate(): void {
let innerHTML: string = this._elemRef.nativeElement.innerHTML || '';
let _defaultValue: string;
if (!this._langKey) {
if (innerHTML.indexOf(":") > -1) {
this._langKey = innerHTML.split(":")[0];
_defaultValue = innerHTML.split(":")[1];
} else {
this._langKey = innerHTML;
}
}
let translated = this.getTranslateLogic(this._langKey, _defaultValue);
// console.log("doTranslate _keyStr:", this._langKey, " ,_defaultValue:", _defaultValue, " ,translated:", translated);
this.renderer.setElementProperty(this._elemRef.nativeElement, 'innerHTML', translated);
}
示例7: setInner
setInner(content) {
this.renderer.setElementProperty(this.element.nativeElement, 'innerHTML', content);
this.hasLoad = true;
}
示例8: _setElementProperty
private _setElementProperty(
renderer: Renderer, renderElement: any, propertyName: string, propertyValue: any) {
renderer.setElementProperty(renderElement, propertyName, propertyValue);
}
示例9: setInputValue
private setInputValue(val: string): void {
this.rndr.setElementProperty(this.el.nativeElement, 'value', val);
}
示例10: ngOnInit
ngOnInit() {
let message = browser.i18n.getMessage(this.name);
if (message) {
this.renderer.setElementProperty(this.el.nativeElement, 'innerHTML', message);
}
}