2017-12-04 23 views
0

에 대한 모든 매개 변수를 확인할 수 없습니다 그 때문에 나는 내 서비스에서 "파일"을 사용할 때 나는 오류 얻을 https://ionicframework.com/docs/native/file/내가 <a href="https://ionicframework.com/docs/native/file-transfer/" rel="nofollow noreferrer">https://ionicframework.com/docs/native/file-transfer/</a></p> <p>을 구현하기 위해 노력하고 파일

을 설치해야합니다

수를 File : (?,?,?,?,?)에 대한 모든 매개 변수를 확인하지 마십시오.

물음표가 순환 참조와 비슷할 수 있다는 것을 알고 있습니다. 다른 어느 곳에서도 사용자 서비스를 사용 해본 적이 없으며 전에 "파일"을 사용하지도 않았습니다.

import {Injectable} from '@angular/core'; 
import {File} from "@ionic-native/file"; 
import { FileTransfer, FileTransferObject } from '@ionic-native/file-transfer'; 

@Injectable() 
export class ImageService { 

    constructor(private file: File, private transfer: FileTransfer) { 

    } 

    public getImagesOfSchedule() { 
    const fileTransfer: FileTransferObject = this.transfer.create(); 
    const url = 'http://techbooster.be/wp-content/uploads/2017/11/logo-long-white.png'; 
    fileTransfer.download(url, this.file.dataDirectory + 'file.pdf').then((entry) => { 
     console.log('download complete: ' + entry.toURL()); 
    }, (error) => { 
     // handle error 
    }); 
    } 

} 

providers: [ 
    StatusBar, 
    AuthenticationService, 
    ScheduleService, 
    ToastService, 
    StorageService, 
    FacebookService, 
    GoogleService, 
    ImageService, 
    Facebook, 
    GooglePlus, 
    PushService, 
    File, <---------------- 
    FileTransfer, <-------------- 
    Push, 
    ScreenOrientation, 
    { 
     provide: HttpService, 
     useFactory: HttpFactory, 
     deps: [XHRBackend, RequestOptions] 
    }, 
    { 
     provide: HttpNoAuthService, 
     useFactory: HttpFactory, 
     deps: [XHRBackend, RequestOptions] 
    }, 
    SplashScreen, 
    {provide: ErrorHandler, useClass: IonicErrorHandler} 

답변

0

내가 자동으로 app.module.ts에서 가져온 파일 클래스가 아니라는 것을 발견 좋아 app.module.ts 대신

import { File } from '@ionic-native/file'; 

그것이 일부 표준 "lib.es6.d.ts"가 자동으로 가져옵니다.

올바른 "파일"클래스를 가져 오십시오!