當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。