2017-07-26 9 views
8

पर क्लिक करने के बाद बदलता है I Imicv2 और Adobe Creative SDK का उपयोग कर फोटो संपादन ऐप बना रहा हूं। मैंने सफलतापूर्वक रचनात्मक एसडीके लागू किया है।आयनिक सेगमेंट केवल सामग्री इनपुट

CSDK सफलतापूर्वक संपादित फ़ाइल का url देता है के बाद, मैं फ़ाइल यूआरएल के साथ एक पृष्ठ खंड युक्त धक्का।

समस्या दूसरे पृष्ठ पर है, जब मैं खंड पर क्लिक करें, यह स्विच नहीं होता है। यह केवल तभी स्विच करेगा जब मैं पृष्ठ के अंदर इनपुट पर क्लिक करता हूं।

मैं CSDK बिना यह कर की कोशिश की और यह किसी भी समस्या के बिना चलाता है।

मेरे कोड:

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 is either a base64 encoded string or a 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 for usage. */ 
     var options = { 
      outputType: CSDKImageEditor.OutputType.JPEG, 
      quality: 70 
     }; 

     /* Launch the Image Editor */ 
     CSDKImageEditor.edit(success, error, base64Image, options); 
    }, (err) => { 
    // Handle error 
    }); 

    } 

    /* Push a new page along with url */ 
    goToCreate(url){ 
    this.nav.push(SecondPage, {url: url}); 
    } 

} 

दूसरा पृष्ठ (शामिल खंड घटक)

section: string; 
url: string; 

    constructor(...) { 
    this.url = navParams.get('url'); 
    console.log(this.url); //Working Perfectly 

    this.section = "segment1"; 
    } 

    onSegmentChanged(segmentButton: SegmentButton) { 
    // console.log('Segment changed to', segmentButton.value); 
    } 

    onSegmentSelected(segmentButton: SegmentButton) { 
    // console.log('Segment selected', segmentButton.value); 
    } 

दूसरा पृष्ठ HTML (जब मैं खंड 2 पर क्लिक करें, अपने वहाँ नहीं जा रहा जब तक कि मैं पर क्लिक करें सेगमेंट के अंदर इनपुट 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> 

प्लस, कंसोल लॉग किसी भी त्रुटि को वापस नहीं कर रहा है। क्या आपको पता चल रहा है कि क्या हो रहा है? मुझे सच में लगता है कि यह सीएसडीके से संबंधित है। धन्यवाद

+0

क्या आपका 'console.log (" सफलता संपादन! ", NewUrl था; 'आग? – Duannx

उत्तर

2

मैं खंड के साथ इस मुद्दे का एक ही तरह का सामना करना पड़ा। जिस तरह से मैंने इसे संभाला था:

import { Component, ViewChild } from '@angular/core'; 
import { IonicPage, NavController, NavParams, Segment, ModalController } from 'ionic-angular'; 

section: string; 
url: string; 
@ViewChild(Segment) 
private segment: Segment; 
constructor(...) { 
    this.url = navParams.get('url'); 
    console.log(this.url); //Working Perfectly 

    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); 
} 
संबंधित मुद्दे