當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Renderer.setElementProperty方法代碼示例

本文整理匯總了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));
    }
開發者ID:crisipix,項目名稱:Angular2WebpackBasicTemplate,代碼行數:13,代碼來源:highlight-directive.ts

示例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));
 }
開發者ID:dszmaj,項目名稱:stocks-app,代碼行數:7,代碼來源:fullList.component.ts

示例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';
     }
 }
開發者ID:PyJava1984,項目名稱:dcm4chee-arc-light,代碼行數:8,代碼來源:placeholderchanger.directive.ts

示例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
 }
開發者ID:pracxs,項目名稱:angular-2-intro,代碼行數:8,代碼來源:highlight.security.directive.ts

示例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'] || '/');
  }
開發者ID:MarcelWaldvogel,項目名稱:angular-meteor-docs,代碼行數:9,代碼來源:app.component.ts

示例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);
 }
開發者ID:PoompisekK,項目名稱:myWork,代碼行數:15,代碼來源:hcm-translate.directive.ts

示例7: setInner

 setInner(content) {
   this.renderer.setElementProperty(this.element.nativeElement, 'innerHTML', content);
   this.hasLoad = true;
 }
開發者ID:riadh-mnasri,項目名稱:angularmovie2-200,代碼行數:4,代碼來源:Lazy.ts

示例8: _setElementProperty

 private _setElementProperty(
     renderer: Renderer, renderElement: any, propertyName: string, propertyValue: any) {
   renderer.setElementProperty(renderElement, propertyName, propertyValue);
 }
開發者ID:4vanger,項目名稱:angular,代碼行數:4,代碼來源:renderer.ts

示例9: setInputValue

 private setInputValue(val: string): void {
   this.rndr.setElementProperty(this.el.nativeElement, 'value', val);
 }
開發者ID:Shivk355,項目名稱:mywork,代碼行數:3,代碼來源:datepickerAutofill.directive.ts

示例10: ngOnInit

 ngOnInit() {
   let message = browser.i18n.getMessage(this.name);
   if (message) {
     this.renderer.setElementProperty(this.el.nativeElement, 'innerHTML', message);
   }
 }
開發者ID:samclark,項目名稱:pinboard,代碼行數:6,代碼來源:i18n.directive.ts


注:本文中的@angular/core.Renderer.setElementProperty方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。