小编Jon*_*ecl的帖子

Ionic 4 中 2 个模块的声明

我有 2 个页面,有 2 个模块,并尝试使用相同的管道,所以我在每个页面中声明了相同的管道。

listview.module.ts

import { DateTimePipe } from '../pipes/dateTime.pipe';

declarations: [ListviewPage, DateTimePipe,]
Run Code Online (Sandbox Code Playgroud)

profile.module.ts

import { DateTimePipe } from '../pipes/dateTime.pipe';

declarations: [ProfilePage, DateTimePipe]
Run Code Online (Sandbox Code Playgroud)

为此,我遇到了这个问题:

错误错误:未捕获(承诺):错误:类型 DateTimePipe 是 2 个模块声明的一部分:ListviewPageModule 和 ProfilePageModule!请考虑将 DateTimePipe 移至导入 ListviewPageModule 和 ProfilePageModule 的更高模块。您还可以创建一个新的 NgModule 来导出并包含 DateTimePipe,然后在 ListviewPageModule 和 ProfilePageModule 中导入该 NgModule。错误:类型 DateTimePipe 是 2 个模块声明的一部分:ListviewPageModule 和 ProfilePageModule!请考虑将 DateTimePipe 移至导入 ListviewPageModule 和 ProfilePageModule 的更高模块。您还可以创建一个新的 NgModule 来导出并包含 DateTimePipe,然后在 ListviewPageModule 和 ProfilePageModule 中导入该 NgModule。

我尝试在 app.module.ts 中声明它但不起作用。

谢谢

declaration ionic4

4
推荐指数
1
解决办法
2945
查看次数

Ionic 4 Camera/ActionSheet对象(...)不是一个功能

我正在尝试在Ionic 4中使用Camera Plugin,当服务启动时没有错误,在浏览器控制台中出现此错误:

安慰

调试

我删除文件夹node_modules并重新安装它,但无法解决此问题.

npm安装

使用ActionSheet我有同样的错误.

包中的依赖关系:

"dependencies": {
    "@angular/common": "~6.1.1",
    "@angular/core": "^6.1.2",
    "@angular/forms": "~6.1.1",
    "@angular/http": "~6.1.1",
    "@angular/platform-browser": "^6.1.2",
    "@angular/platform-browser-dynamic": "~6.1.1",
    "@angular/router": "~6.1.1",
    "@ionic-native/action-sheet": "^4.11.0",
    "@ionic-native/camera": "^4.11.0",
    "@ionic-native/core": "^5.0.0-beta.14",
    "@ionic-native/file-transfer": "^4.11.0",
    "@ionic-native/network": "^4.11.0",
    "@ionic-native/splash-screen": "5.0.0-beta.14",
    "@ionic-native/status-bar": "5.0.0-beta.14",
    "@ionic/angular": "^4.0.0-beta.2",
    "@ionic/lab": "^1.0.6",
    "@ionic/ng-toolkit": "^1.0.6",
    "@ionic/schematics-angular": "^1.0.0",
    "cordova-android": "^7.1.1",
    "cordova-android-support-gradle-release": "^1.4.4",
    "cordova-ios": "4.5.5",
    "cordova-plugin-actionsheet": "^2.3.3",
    "cordova-plugin-camera": "^4.0.3",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-file": "^6.0.1",
    "cordova-plugin-file-transfer": "^1.7.1",
    "cordova-plugin-ionic-keyboard": "^2.1.2",
    "cordova-plugin-ionic-webview": "^2.0.2",
    "cordova-plugin-network-information": "^2.0.1",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "core-js": "^2.5.3",
    "promise-polyfill": "^8.0.0",
    "rxjs": "^6.2.2",
    "rxjs-compat": "^6.2.2",
    "zone.js": …
Run Code Online (Sandbox Code Playgroud)

object ionic-framework cordova-plugins ionic4

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