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


TypeScript Renderer.createElement方法代码示例

本文整理汇总了TypeScript中@angular/core.Renderer.createElement方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Renderer.createElement方法的具体用法?TypeScript Renderer.createElement怎么用?TypeScript Renderer.createElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在@angular/core.Renderer的用法示例。


在下文中一共展示了Renderer.createElement方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: delayTime

  @Input('cardInit')
  set delayTime(loading: Observable<any>) {

    // build additional templating for loader
    this.viewContainerRef.createEmbeddedView(this.templateRef);
    var card = this.templateRef.elementRef.nativeElement.nextSibling;
    var lelement = this.renderer.createElement(card, 'md-card-loading-overlay');
    var lanimation = this.renderer.createElement(card, 'md-card-loading-animation');
    this.renderer.setElementClass(lanimation, 'fa', true);
    this.renderer.setElementClass(lanimation, 'fa-spinner', true);
    this.renderer.setElementClass(lanimation, 'fa-pulse', true);
    this.renderer.setElementClass(lanimation, 'fa-3x', true);
    this.renderer.setElementClass(lanimation, 'fa-fw', true);

    // handle data completion
    loading.subscribe(
      () => { },
      error => {
        this.renderer.setElementClass(lanimation, 'hidden', true);
        var errormsg = this.renderer.createElement(lelement, 'h3');
        this.renderer.setText(errormsg, error);
        setTimeout(() => $(lanimation).remove() , 200)        
      },
      () => {
               
        this.renderer.setElementClass(lanimation, 'hidden', true);
        this.renderer.setElementClass(lelement, 'hidden', true);
        setTimeout(() => $(lanimation).remove() , 200)
        setTimeout(() => $(lelement).remove() , 200)
      }
    )
  }
开发者ID:cholewa1992,项目名称:ReviewIT,代码行数:32,代码来源:card-init.directive.ts

示例2: 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'] || '/');
  }
开发者ID:MarcelWaldvogel,项目名称:angular-meteor-docs,代码行数:9,代码来源:app.component.ts

示例3: build

    build(): void {
        this.body = document.body;

        let anchor = this.renderer.createElement(this.body, 'a');
        this.renderer.setElementStyle(anchor, 'visibility', 'hidden');
        this.renderer.setElementAttribute(anchor, 'href', 'data:text/csv;charset=utf-8,' + encodeURIComponent(this.csvData));
        this.renderer.setElementAttribute(anchor, 'target', '_blank');
        this.renderer.setElementAttribute(anchor, 'download', this.filename);

        setTimeout(() => {
            this.renderer.invokeElementMethod(anchor, 'click');
            this.renderer.invokeElementMethod(anchor, 'remove');
        }, 15);
    }
开发者ID:finleysg,项目名称:bhmc,代码行数:14,代码来源:download-csv.component.ts

示例4: touchStart

    /**
     * proceed the touchStart event on a task (similar to dragStart on html5 dnd api, but we need to create the shadow by ourselves)
     *
     * @param event
     * @param task
     * @param taskEl
     */
    touchStart(event, task, taskEl) {
        event.preventDefault();
        this.currentDndTask = task;
        this.currentTouchTarget = event.target;
        this.currentTouchShadow = this._renderer.createElement(taskEl, 'div', null);
        this.currentTouchShadow.style.position = "fixed";
        this.currentTouchShadow.style.height = taskEl.clientHeight;
        this.currentTouchShadow.style.width = taskEl.clientWidth;
        this.currentTouchShadow.innerHTML = taskEl.innerHTML;

        this.offsetX = event.targetTouches[0].clientX - taskEl.getBoundingClientRect().left;
        this.offsetY = event.targetTouches[0].clientY - taskEl.getBoundingClientRect().top;

        this.currentTouchShadow.style.left = taskEl.getBoundingClientRect().left;
        this.currentTouchShadow.style.top = taskEl.getBoundingClientRect().top;
    }
开发者ID:AIESEC-Egypt,项目名称:mgmt-frontend,代码行数:23,代码来源:tasklist.component.ts

示例5: jQuery

 jQuery.getJSON(url, ()=> {
     var path = `https://${source}/Snapshots/business${businessId}/station${stationId}/${fileName}.jpg`;
     jQuery(this.elRef.nativeElement).find('.newImage').fadeOut(200);
     var img = this.renderer.createElement(this.elRef.nativeElement, 'img', null);
     jQuery(img).addClass('snap');
     var int$ = Observable.interval(500).do(()=> {
         img.src = path;
     })
     var $err = Observable.fromEvent(img, 'error').do(()=>{
         jQuery(this.elRef.nativeElement).find('.snap').remove();
     })
     var load$ = Observable.fromEvent(img, 'load')
     var subscription = Observable.merge(int$, $err).takeUntil(load$).delay(500).subscribe((res)=> {
         subscription.unsubscribe();
     })
 });
开发者ID:amurarnd,项目名称:studioDashboard,代码行数:16,代码来源:StationSnapshot.ts

示例6: createScript

  createScript(src: string, renderer: Renderer, elmRef?: ElementRef, callback?: () => void): HTMLScriptElement {
    let script = elmRef ? renderer.createElement(elmRef.nativeElement, 'script', null) :
      this.getOwnerDocument().createElement('script');

    script.type = 'text/javascript';
    script.src = src;
    script.async = true;
    script.charset = 'UTF-8';
    script.id = `rebirth_script_${Math.random()}`;
    if (callback) {
      script.onreadystatechange = script.onload = () => {
        if ((!script.readyState || /loaded|complete/.test(script.readyState))) {
          callback();
        }
      };
    }
    return script;
  }
开发者ID:xiaomo-info,项目名称:xiaomo-info-web,代码行数:18,代码来源:window.ts

示例7: _createElement

 private _createElement(renderer: Renderer, parentElement: any, name: string, elId: number) {
   this._renderStore.store(renderer.createElement(parentElement, name, null), elId);
 }
开发者ID:4vanger,项目名称:angular,代码行数:3,代码来源:renderer.ts

示例8: setTimeout

 error => {
   this.renderer.setElementClass(lanimation, 'hidden', true);
   var errormsg = this.renderer.createElement(lelement, 'h3');
   this.renderer.setText(errormsg, error);
   setTimeout(() => $(lanimation).remove() , 200)        
 },
开发者ID:cholewa1992,项目名称:ReviewIT,代码行数:6,代码来源:card-init.directive.ts


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