本文整理汇总了TypeScript中@angular/core.Renderer2.setProperty方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Renderer2.setProperty方法的具体用法?TypeScript Renderer2.setProperty怎么用?TypeScript Renderer2.setProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/core.Renderer2
的用法示例。
在下文中一共展示了Renderer2.setProperty方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
this.menuService.getSelectedItem().subscribe((event: {tag: string, item: any}) => {
if (event && event.item && event.item.data) {
this.currentItem = event.item.data;
this.renderer.setProperty(document.body, 'scrollTop', 0);
}
});
示例2: disableElement
disableElement(){
if (this.el.nativeElement.tagName === 'INPUT'){
this.renderer.setProperty(this.el.nativeElement, 'disabled', true);
}
if (this.el.nativeElement.tagName === 'DIV'){
this.el.nativeElement.style.display = 'none';
}
}
示例3: updateVisibility
// I get called by the LazyViewport service when the element associated with this
// directive has its visibility changed.
public updateVisibility( isVisible: boolean, ratio: number ) : void {
// When this target starts being tracked by the viewport, the initial visibility
// will be reported, even if it is not visible. As such, let's ignore the first
// visibility update.
if ( ! isVisible ) {
return;
}
// Now that the element is visible, load the underlying SRC value. And, since we
// no longer need to worry about loading, we can detach from the LazyViewport.
this.lazyViewport.removeTarget( this );
this.lazyViewport = null;
this.renderer.setProperty( this.element, "src", this.src );
// If an active class has been provided, add it to the element.
( this.visibleClass ) && this.renderer.addClass( this.element, this.visibleClass );
}
示例4: setProperty
private setProperty(r: Renderer2, el: any, name: string, value: any) {
r.setProperty(el, name, value);
}
示例5: ngAfterViewInit
ngAfterViewInit() {
const hasAllowableOperations = this.contentService.hasAllowableOperations(this.node, AllowableOperationsEnum.LOCK);
this.renderer.setProperty(this.element.nativeElement, 'disabled', !hasAllowableOperations);
}
示例6: onClick
@HostListener('click') onClick() {
const description = this.element.nativeElement.nextElementSibling;
const state = description.hidden;
this.renderer.setProperty(description, 'hidden', !state);
}
示例7: setInputValue
private setInputValue(val: string): void {
this.rndr.setProperty(this.el.nativeElement, 'value', val);
}
示例8: ngOnChanges
ngOnChanges(_: SimpleChanges) {
if (this.content && this.elementRef) {
this.renderer.setProperty(this.elementRef.nativeElement, 'innerHTML', this.markdownService.compile(this.content));
}
}
示例9: constructor
constructor(private renderer: Renderer2) {
this.renderer.setProperty(document.body, "scrollTop", 0);
}
示例10: ngOnInit
ngOnInit() {
this.renderer.setStyle(this.el.nativeElement, 'color', 'red');
this.renderer.setAttribute(this.el.nativeElement, 'color', 'success');
this.renderer.setProperty(this.el.nativeElement, 'color', 'success');
// this.el.nativeElement.setValue('test');
}