当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Renderer2.setProperty方法代码示例

本文整理汇总了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);
          }
        });
开发者ID:ManigandanRaamanathan,项目名称:react-native-ui-kitten,代码行数:7,代码来源:page.component.ts

示例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';
     }
 }
开发者ID:dhanzhang,项目名称:dcm4chee-arc-light,代码行数:8,代码来源:placeholderchanger.directive.ts

示例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 );

	}
开发者ID:bennadel,项目名称:JavaScript-Demos,代码行数:23,代码来源:lazy-src.directive.ts

示例4: setProperty

 private setProperty(r: Renderer2, el: any, name: string, value: any) {
   r.setProperty(el, name, value);
 }
开发者ID:Cammisuli,项目名称:angular,代码行数:3,代码来源:renderer.ts

示例5: ngAfterViewInit

 ngAfterViewInit() {
     const hasAllowableOperations = this.contentService.hasAllowableOperations(this.node, AllowableOperationsEnum.LOCK);
     this.renderer.setProperty(this.element.nativeElement, 'disabled', !hasAllowableOperations);
 }
开发者ID:Alfresco,项目名称:alfresco-ng2-components,代码行数:4,代码来源:node-lock.directive.ts

示例6: onClick

  @HostListener('click') onClick() {
    const description = this.element.nativeElement.nextElementSibling;
    const state = description.hidden;

    this.renderer.setProperty(description, 'hidden', !state);
  }
开发者ID:IZhuhan,项目名称:news-app,代码行数:6,代码来源:show-description.directive.ts

示例7: setInputValue

 private setInputValue(val: string): void {
   this.rndr.setProperty(this.el.nativeElement, 'value', val);
 }
开发者ID:kumi20,项目名称:wyprawka,代码行数:3,代码来源:datepickerAutofill.directive.ts

示例8: ngOnChanges

 ngOnChanges(_: SimpleChanges) {
     if (this.content && this.elementRef) {
         this.renderer.setProperty(this.elementRef.nativeElement, 'innerHTML', this.markdownService.compile(this.content));
     }
 }
开发者ID:kencinder,项目名称:steam-rom-manager,代码行数:5,代码来源:markdown.component.ts

示例9: constructor

 constructor(private renderer: Renderer2) {
   this.renderer.setProperty(document.body, "scrollTop", 0);
 }
开发者ID:AhmedFawzy,项目名称:react-native-ui-kitten,代码行数:3,代码来源:homepage.component.ts

示例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');
 }
开发者ID:harishfysx,项目名称:AngDashBoard2,代码行数:6,代码来源:style-result.directive.ts


注:本文中的@angular/core.Renderer2.setProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。