2016-12-06 2 views
0

이 문제를 해결하는 데 도움주세요 http 모듈이 요청을 완료 한 후 다른 프레임을 탐색하고 싶습니다. 아래 코드 :http 모듈 nativescript 내에서 이동

var datanya = 'token='+konfigurasi.tokenapps+'&email='+inputan['email']+'&nama='+inputan['nama']+'&handphone='+inputan['handphone']+'&alamat='+inputan['alamat']+'&longitude='+longi+'&latitude='+lat    +'&model='+cekPlatform.device.model+'&tipe='+cekPlatform.device.deviceType+'&manufaktur='+cekPlatform.device.manufacturer 
+'&region='+cekPlatform.device.region; 
httpModul.request({ 
        url: 'http://example.com/c_user/daftar/', 
        method: "POST", 
        timeout: 10000, 
        headers: { "Content-Type": "application/x-www-form-urlencoded" }, 
        content: datanya 

       }).then(function(response){ 
        //console.log(JSON.stringify(response)); 
        //console.log(response); 

        console.log('data diterima : '+response.content); 
        var jsondata = response.content.toJSON(); 
        console.log('JSON Data hasil '+JSON.stringify(response.content)); 
        loader.hide(); 
        if(jsondata.hasil=='error'){ 
         console.log('error '+jsondata.alasan); 
         Toast.makeText(jsondata.alasan, "long").show(); 
        }else{ 
         console.log('success : '+jsondata.alasan); 
         Toast.makeText(jsondata.alasan, "long").show(); 

         //navigate 
         fm.topmost().navigate("otp/cek_daftar"); 
         console.log('navigation passed'); 

        } 
       },function(err){ 
        //return error; 
        Toast.makeText('Error : '+err, "long").show(); 
        console.log(err); 
       }) 

그러나 탐색 기능은 작동하지 않습니다. 검색에서 나는 정보를 HTTP 모듈을 사용 비동기 어쩌면 그것은 동기식을 사용하는 탐색과 함께 작동하지 않을거야.

감사합니다.

답변

0

다운로드 약속 처리기에서 잘 탐색 할 수 있습니다. 나는 나의 프로젝트 중 하나에서 그렇게한다. 주문을 다운로드 한 다음 주문 화면으로 이동하십시오. 그러나 몇 가지가있을 수 :

  1. 합니까 FM = 당신의 탐색에서

  2. require ('ui/frame'); 당신이 볼 수있는 탐색 주위에 시도/캐치를 넣어 시도 가지고 당신이

  3. .navigate('~/otp/cek_daftar');을 시도해야 해당 페이지가 탐색하지 않는 이유는 페이지에 버그가있어 실패 할 수 있습니다 ...

  4. 콘솔을 받고 있습니까? console.log('data diterima : '+response.content);