标签: ionic-framework

Ionic 4发行后,Ionic 3错误安装本机插件

安装Native Store成功后,使用本地插件ionic 3出现问题,但是当我尝试添加应用模块时,文本编辑器显示红线,而当我尝试运行时,发现了如下错误。我在这里安装本机商店(https://ionicframework.com/docs/v3/native/native-storage/)

文本编辑器中的红线,安装成功,但是在应用模块中添加时显示红线。 在此处输入图片说明

在此处输入图片说明

当运行“ ionic cordova run android”时,这是控制台中的错误。

[14:40:05]  ionic-app-scripts 3.1.8
[14:40:05]  build dev started ...
[14:40:05]  clean started ...
[14:40:05]  clean finished in 71 ms
[14:40:05]  copy started ...
[14:40:07]  deeplinks started ...
[14:40:08]  deeplinks finished in 1.04 s
[14:40:08]  transpile started ...
[14:40:27]  typescript: D:/myProject/ionic/myApp/src/app/app.module.ts, line: 57
            Argument of type '{ declarations: (typeof VerificationPage | typeof LoginPage | typeof PrivacyRegisterPage |
            typeof...' is not assignable to parameter of type 'NgModule'. Types of property 'providers' are …
Run Code Online (Sandbox Code Playgroud)

ionic-framework cordova-plugins

3
推荐指数
2
解决办法
5622
查看次数

带有ngFor的Ionic 4水平滚动

我很茫然。我可以使水平滚动仅与html和css一起正常工作,但是当我介绍ngFor时,它拒绝产生相同的效果。是否有人对此有经验,或者知道如何解决此问题?

这是我不起作用的简单代码:

这个例子产生一个垂直列表:

<div class="container" *ngFor="let item of items | async">
        <div class="scroll" scrollX="true">
         <span>{{item.ProjectEvent}}</span>
        </div>
    </div>
Run Code Online (Sandbox Code Playgroud)

这产生了一个可以水平滚动的宽容器

 <div class="container" >
        <div class="scroll" scrollX="true">
            <span>item1</span>
            <span>item2</span>
            <span>item3</span>
            <span>item4</span>
            <span>item5</span>
            <span>item6</span>
            <span>item7</span>
            <span>item8</span>
            <span>item9</span>
        </div>
    </div>
Run Code Online (Sandbox Code Playgroud)

两者的CSS相同:

.container {
  width: 100px;
  background-color: green;
  overflow: hidden; 
  white-space: nowrap;
  ::-webkit-scrollbar {
    display: none;
  }
  .scroll {
    overflow: auto;
  }
}
Run Code Online (Sandbox Code Playgroud)

向我解释一下史波克先生!

我在这里先向您的帮助表示感谢!

良好措施的依赖性:

"dependencies": {
    "@angular/common": "^7.1.4",
    "@angular/core": "^7.1.4",
    "@angular/fire": "^5.1.1",
    "@angular/forms": "^7.1.4",
    "@angular/http": "^7.1.4",
    "@angular/platform-browser": "^7.1.4",
    "@angular/platform-browser-dynamic": "^7.1.4",
    "@angular/router": "^7.1.4",
    "@ionic-native/core": "5.0.0-beta.21", …
Run Code Online (Sandbox Code Playgroud)

css ionic-framework ngfor angular ionic4

3
推荐指数
2
解决办法
7141
查看次数

不能将类型“ AppVersionOriginal”分配给类型“提供者”。类型“ AppVersionOriginal”缺少以下属性

我使用下面的最新版本的Ionic CLI v4.9.0创建了新的Ionic 3应用程序

$ ionic start Ionic3Project blank --type ionic-angular
Run Code Online (Sandbox Code Playgroud)

默认情况下会创建V4 Ionic项目。

然后我在这里按照步骤进行本机应用程序版本插件

导入app.module.ts文件时遇到以下控制台错误

Uncaught Error: Invalid provider for the NgModule 'AppModule' - only instances of Provider and Type are allowed, got: [StatusBar, ?[object Object]?, ...]
at syntaxError (compiler.js:486)
at compiler.js:15784
at Array.forEach (<anonymous>)
at CompileMetadataResolver._getProvidersMetadata (compiler.js:15752)
at CompileMetadataResolver.getNgModuleMetadata (compiler.js:15320)
at JitCompiler._loadModules (compiler.js:34413)
at JitCompiler._compileModuleAndComponents (compiler.js:34374)
at JitCompiler.compileModuleAsync (compiler.js:34268)
at CompilerImpl.compileModuleAsync (platform-browser-dynamic.js:239)
at PlatformRef.bootstrapModule (core.js:5578)
Run Code Online (Sandbox Code Playgroud)

app.module.ts文件

    import { BrowserModule } from '@angular/platform-browser';
    import { …
Run Code Online (Sandbox Code Playgroud)

ionic-framework ionic-native ionic4

3
推荐指数
1
解决办法
660
查看次数

导入FileTransfer时出现问题-ionic 3

我已经安装了文件传输插件,因为它在这里提到

这是app.module.ts中的代码:

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

providers: [
   ...
   FileTransfer,
   ...
]
Run Code Online (Sandbox Code Playgroud)

这是错误

类型“ FileTransferOriginal”不可分配给“提供者”类型。类型'FileTransferOriginal'缺少类型'FactoryProvider'的以下属性:提供,useFactoryts(2322)(别名)const FileTransfer:FileTransferOriginal导入FileTransfer

ionic-framework cordova-plugins ionic3

3
推荐指数
1
解决办法
582
查看次数

使用文件传输插件时出现错误-Ionic 3

我正在尝试使用以下方式将图像上传到服务器

"cordova-plugin-file-transfer": "^1.7.1",

"@ionic-native/file-transfer": "^5.0.0",
Run Code Online (Sandbox Code Playgroud)

component.ts

takePicture() {
  const options: CameraOptions = {
    quality: 50,
    destinationType: this.camera.DestinationType.FILE_URI,
    encodingType: this.camera.EncodingType.JPEG,
    mediaType: this.camera.MediaType.PICTURE,
    sourceType: this.camera.PictureSourceType.PHOTOLIBRARY,
    targetWidth: 500,
    targetHeight: 500,
    saveToPhotoAlbum: false
  };

  this.camera.getPicture(options)
  .then((imageData) => this._img.uploadImage(imageData))
  .catch(err => console.log(err));
}
Run Code Online (Sandbox Code Playgroud)

imageProvider.ts

import { FileTransfer, FileUploadOptions, FileTransferObject } from "@ionic-native/file-transfer/ngx";

   ...

uploadImage(img) {

  const url = `${this.apiURL}/images/upload`;

  // File for Upload
  var targetPath = img;

  var options: FileUploadOptions = {
    fileKey: 'image',
    chunkedMode: false,
    mimeType: 'multipart/form-data'
  };

  const fileTransfer: FileTransferObject = this.transfer.create();

  fileTransfer.upload(targetPath, …
Run Code Online (Sandbox Code Playgroud)

ionic-framework cordova-plugins ionic3

3
推荐指数
1
解决办法
1501
查看次数

Xcode设备列表在Ionic / Cordova项目中为空

无论我如何尝试,都无法从ionic / cordova项目访问Xcode模拟器。Xcode命令行工具已安装。

cordova run ios --list
Run Code Online (Sandbox Code Playgroud)

退货

可用的ios设备:

可用的ios虚拟设备:

ionic cordova emulate ios --list
Run Code Online (Sandbox Code Playgroud)

退货

可用的ios虚拟设备:

我在Xcode中拥有所有模拟器,当我在Xcode中打开项目并手动运行模拟器时,它运行良好。

这样的后果是我无法通过终端的livereload运行我的应用程序:

ionic cordova emulate --livereload ios -- --buildFlag="-UseModernBuildSystem=0" --target="iPhone-X, 12.1"
Run Code Online (Sandbox Code Playgroud)

退货

找不到设备名称“ iPhone X”和运行时“ iOS 12.1”的设备ID,或者该设备ID不可用。

在此处输入图片说明

xcode ios ios-simulator cordova ionic-framework

3
推荐指数
1
解决办法
1071
查看次数

如何在屏幕的中心位置显示离子微调器?

我的离子项目中有一个微调器。我想将微调器放在屏幕的中央位置。但它始终显示在左上角,如下所示:

在此处输入图片说明

HTML文件是:

<div *ngIf="spinner == 'true'">
   <ion-spinner name="bubbles"></ion-spinner>
</div>
Run Code Online (Sandbox Code Playgroud)

我的scss文件是:

page-login {
    ion-spinner {
    width: 28px;
    height: 28px;
    stroke: #444;
    fill: #222;
  }
}
Run Code Online (Sandbox Code Playgroud)

你能帮我吗?

ionic-framework ionic3

3
推荐指数
1
解决办法
971
查看次数

Angular @ViewChild错误'无法读取未定义的属性nativeElement”

我是Angular的新手,正面临这个问题。

我想检查变量的值elementRef是否在显示数据之前为空,因为我想显示图表。这是我的代码:

component.ts

@ViewChild('normalDeviasiDaily', {read: ElementRef}) normalDeviasiDaily: ElementRef;
Run Code Online (Sandbox Code Playgroud)

component.html

  <div *ngIf="normalDeviasiDaily">
    <div #normalDeviasiDaily id="normalDeviasiDaily">
      <canvas style="width:100%; height:400px;"></canvas>
    </div>
  </div>
  <div *ngIf="!normalDeviasiDaily">
    <skeleton-item height="400px"></skeleton-item>
  </div>
Run Code Online (Sandbox Code Playgroud)

我的问题是cannot read property nativeElement of undefined,有没有其他人遇到过,请帮助我。

谢谢。

ionic-framework angular angular5

3
推荐指数
1
解决办法
1480
查看次数

Not able to align ion-avatar to the center of &lt;ion-item&gt; in Ionic 4

I am working in my Ionic 4 project and I have added the ion-avatar but it is not coming in the center of the

This is my editprofile.page.html:

<ion-item class="newitem2">
    <ion-avatar>
        <img name="profile_pic" [src]="this.userdetailsedit.value.profile_pic"/>
    </ion-avatar>   
</ion-item>
Run Code Online (Sandbox Code Playgroud)

Any help is much appreciated.

ionic-framework ionic4

3
推荐指数
1
解决办法
813
查看次数

创建项目时离子生成失败

我已经ionic安装了系统。当我运行时,ionic run app tabs它会安装所有npm软件包,但提示落到

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.11.0/linux-x64-72_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v4.11.0/linux-x64-72_binding.node":

HTTP error 404 Not Found

Run Code Online (Sandbox Code Playgroud)

然后失败,并显示提示

gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/velansalis/code/greenlink/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:196:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:256:12)
gyp ERR! System Linux 4.15.0-47-generic
gyp ERR! command "/home/velansalis/.nvm/versions/node/v12.0.0/bin/node" "/home/velansalis/code/greenlink/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /home/velansalis/code/greenlink/node_modules/node-sass
gyp ERR! node -v v12.0.0 …
Run Code Online (Sandbox Code Playgroud)

installation build node.js npm ionic-framework

3
推荐指数
1
解决办法
802
查看次数