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


TypeScript ChangeDetectorRef.detectChanges方法代码示例

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


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

示例1:

 this.instances$.then(instances => {
   this.changeDetector.detectChanges();
   this.selectionList.options.forEach(option => {
     if (option.value === instance.name) {
       option.selected = true;
     }
   });
   this.changeDetector.detectChanges();
 });
开发者ID:,项目名称:,代码行数:9,代码来源:

示例2:

 this.geocoder.geocode({'address': address}, (results, status) => {
   if (status === google.maps.GeocoderStatus.OK) {
     this.contact.coordinates = results[0].geometry.location.lat().toString() + ',' + results[0].geometry.location.lng().toString();
     this.errorAddress = false;
     this.changeDetectorRef.detectChanges();
   } else {
     this.errorAddress = true;
     this.changeDetectorRef.detectChanges();
   }
 });
开发者ID:ScienceSoft-Inc,项目名称:XamarinDiscountsApp,代码行数:10,代码来源:contact.component.ts

示例3: switch

 this.init.getFilterContentData(f).subscribe(res =>{                              
     switch (res.status) {
         case false:
             this.dataNotFound = !res.status;
             this.chng.detectChanges()
             break;           
         case true:
             this.dataNotFound = !res.status; 
             this.chng.detectChanges()
             break;
     }
     this.responsesFound = res.content.length;
     this.chng.detectChanges()
     this.contentData.next(res.content.content) 
 })       
开发者ID:daviddexter,项目名称:wajibu,代码行数:15,代码来源:filter.component.ts

示例4: onMessageReceived

 private onMessageReceived(e: MessageEvent) {
     console.log('remote got a messsage ', e.data, e.origin);
     if (e.origin === 'http://localhost:3000') {
         this.message = e.data;
         this.changeDetectorRef.detectChanges();
     }
 }
开发者ID:tnclark8012,项目名称:angular-postMessage,代码行数:7,代码来源:remote.component.ts

示例5:

    this.client.emitter.subscribe((message) => {

      if (message === 'open') {
        this.isConnected = true;
        this.headerState = 'inactive';
        this.isConnecting = false;

        let msg = JSON.stringify({
          tracks: this.tracks,
          currentTrack: this.currentTrack,
          control: 'tracklist'
        });

        if (this.client && this.client.channel) {
          this.client.channel.send(msg);
        }

        this.client.observer.subscribe((res) => {

          let msg = res[res.length - 1].data;
          this.updateMessages(msg);

        });

        this.ref.detectChanges();

      }

    });
开发者ID:edicon,项目名称:ng2-examples-cli,代码行数:29,代码来源:synth.component.ts

示例6:

 response.text().then(text => {
   this.scriptContainer.nativeElement.innerHTML = text;
   this.editor = ace.edit(this.scriptContainer.nativeElement);
   this.editor.setReadOnly(true);
   this.editor.getSession().setMode('ace/mode/javascript');
   this.changeDetector.detectChanges();
 });
开发者ID:m-sc,项目名称:yamcs,代码行数:7,代码来源:ScriptViewer.ts

示例7:

 ]).then(selections => {
     this.selectedExchange    = selections[0];
     this.selectedCurrency    = selections[1];
     this.availableCurrencies = selections[2];
     this.changeDetector.detectChanges();
     this.stopLoading();
 });
开发者ID:faircoin,项目名称:fairpocket-mobile-app,代码行数:7,代码来源:currency.ts

示例8:

 this.sessionTimedOutSubject.subscribe(e => {
     this.showSessionTimeout = !FT.isApplicationEmbedded();
     // Since anyone can call sessionTimedOutSubject,
     // an update can happen outside of the Angular Zone and would not
     // detect a change, therefore call it manually
     this.cd.detectChanges();
 });
开发者ID:mdharamadas1,项目名称:admiral,代码行数:7,代码来源:app.component.ts

示例9: ngAfterViewInit

  ngAfterViewInit() {
    this.basicGrid.setSort('name');
    this.basicGrid.setPageSize(50);
    this.basicGrid.render();

    this.changeDetectorRef.detectChanges();
  }
开发者ID:gustavobrian,项目名称:ng2-grid,代码行数:7,代码来源:demo.component.ts

示例10: if

      device => {

        if (device.rssi <= -95) {
          this.vibrationThreshold += 1;
          device.distance = "far";
        } else if (device.rssi > -95 && device.rssi <= -80) {
          this.vibrationThreshold += 1;
          device.distance = "not so close";
        } else if (device.rssi > -80) {
          this.vibrationThreshold = 0;
          device.distance = "close";
        }

        if (this.vibrationThreshold >= 3) {
          console.log("Attempting to vibrate...");
          Vibration.vibrate(2000);
        }

        this.foundDevices.push(device);
        console.log("Found: " + JSON.stringify(device));

        // It seems I need to use the ChangeDetectorRef to get the UI to update whenever a device is detected
        this.cd.detectChanges();

      },
开发者ID:asyncsrc,项目名称:BLEChild,代码行数:25,代码来源:home.ts


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