DOM not updating anymore after getting barcode scanner plugin's result in 2.0.0-beta.11


#1

After I have updated my ionic2 project to 2.0.0-beta.11, DOM does not get updated anymore when I get the barcode scanner plugin’s result in promise.

My ionic info:

Cordova CLI: 6.3.1
Ionic Framework Version: 2.0.0-beta.11
Ionic CLI Version: 2.1.0-beta.3
Ionic App Lib Version: 2.1.0-beta.1
OS:
Node Version: v6.2.2

My package.json

{
  "dependencies": {
    "@angular/common": "2.0.0-rc.4",
    "@angular/compiler": "2.0.0-rc.4",
    "@angular/core": "2.0.0-rc.4",
    "@angular/http": "2.0.0-rc.4",
    "@angular/platform-browser": "2.0.0-rc.4",
    "@angular/platform-browser-dynamic": "2.0.0-rc.4",
    "@angular/router": "2.0.0-rc.2",
    "es6-shim": "^0.35.0",
	  "@angular/forms": "0.2.0",
    "ionic-angular": "^2.0.0-beta.11",
    "ionic-native": "^1.3.10",
    "ionicons": "^3.0.0",
    "reflect-metadata": "^0.1.3",
    "rxjs": "5.0.0-beta.6",
    "zone.js": "^0.6.12"
  },
  "devDependencies": {
    "del": "2.2.0",
    "gulp": "3.9.1",
    "gulp-watch": "4.3.5",
    "ionic-gulp-browserify-typescript": "2.0.0",
    "ionic-gulp-fonts-copy": "^1.0.0",
    "ionic-gulp-html-copy": "^1.0.0",
    "ionic-gulp-sass-build": "^1.0.0",
    "ionic-gulp-scripts-copy": "^2.0.0",
    "run-sequence": "1.1.5"
  },
...

My code:

  barCode() {

      BarcodeScanner.scan().then((barcodeData) => {

        
        //this.ngZone.run(() =>{
           this.adicionarItemCarrinhoUPC(barcodeData.text);

         //});   
      });     


  }

My “adicionarItemCarrinhoUPC” function does not get called until I interact with the UI.

With “NGZone”, DOM does get updated sometimes only.

Any suggestions?

Thank you in advance.


#2

Turns out that after updating my android sdk, dom is getting updated again when I use setTimeout( () => {this.applicationRef.tick(), 10});

Here is how I updated my android SDK:

android update sdk --no-ui --all --filter "extra-android-m2repository"

I haven’t tried it in IOS yet though.