angular - Ionic segment only change after clicking on content input -


im building photo editing app using ionicv2 , adobe creative sdk. i've succesfully implemented creative sdk.

after csdk succesfully returns url of edited file, push page containing segment along file url.

the problem on second page, when click on segment, not switch. switch if click on input inside page.

i tried doing without csdk , runs without problem.

my code:

loadcamera(sourcetype){      const options: cameraoptions = {       quality: 100,       destinationtype: this.camera.destinationtype.data_url,       encodingtype: this.camera.encodingtype.jpeg,       mediatype: this.camera.mediatype.picture,       sourcetype: sourcetype     }      this.camera.getpicture(options).then((imagedata) => {        // imagedata either base64 encoded string or file uri       // if it's base64:       let base64image = 'data:image/jpeg;base64,' + imagedata;        var thismodule = this;        function success(newurl) {           console.log("success editing!", newurl);           thismodule.gotocreate(newurl);       }        function error(error) {           console.log("error!", error);       }        /* optional `options` object. see api guide usage. */       var options = {            outputtype: csdkimageeditor.outputtype.jpeg,             quality: 70       };        /* launch image editor */       csdkimageeditor.edit(success, error, base64image, options);     }, (err) => {     // handle error     });    }    /* push new page along url */   gotocreate(url){     this.nav.push(secondpage, {url: url});   }  } 

second page (contains segment component)

section: string; url: string;    constructor(...) {     this.url = navparams.get('url');     console.log(this.url); //working      this.section = "segment1";   }    onsegmentchanged(segmentbutton: segmentbutton) {     // console.log('segment changed to', segmentbutton.value);   }    onsegmentselected(segmentbutton: segmentbutton) {     // console.log('segment selected', segmentbutton.value);   } 

second page html (when click on segment 2, not going there unless click on input inside segment 1)

<ion-content class="secondpage-content">   <ion-segment class="secondpage-segment" [(ngmodel)]="section" (ionchange)="onsegmentchanged($event)">     <ion-segment-button value="segment1" (ionselect)="onsegmentselected($event)">       segment 1     </ion-segment-button>     <ion-segment-button value="segment2" (ionselect)="onsegmentselected($event)">       segment 2     </ion-segment-button>     <ion-segment-button value="segment3" (ionselect)="onsegmentselected($event)">       segment 3     </ion-segment-button>   </ion-segment>   <div [ngswitch]="section">     <div *ngswitchcase="'segment1'" >       <ion-item>         <ion-label floating>input</ion-label>         <ion-input type="text" formcontrolname="input_example"></ion-input>       </ion-item>     </div>     <div *ngswitchcase="'segment2'" >     </div>     <div *ngswitchcase="'segment3'" >     </div>   </div> </ion-content> 

plus, console logs not returning errors. have idea on whats going on? think related csdk. thank you

i encountered same kind of issue segment. way tackled was:

import { component, viewchild } '@angular/core'; import { ionicpage, navcontroller, navparams, segment, modalcontroller } 'ionic-angular';  section: string; url: string; @viewchild(segment) private segment: segment; constructor(...) {     this.url = navparams.get('url');     console.log(this.url); //working      this.section = "segment1";     settimeout(() => {         if (this.segment) {             this.segment.ngaftercontentinit();             this.segment._inputupdated();             this.onsegmentchanged(null)         }     }); }  onsegmentchanged(segmentbutton: segmentbutton) {     // console.log('segment changed to', segmentbutton.value); }  onsegmentselected(segmentbutton: segmentbutton) {     // console.log('segment selected', segmentbutton.value); } 

Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -