Angularjs   发布时间:2022-04-20  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了使用`–prod`在`building中的angular – ionic scrolling header package问题(请添加一个@NgModule注释.)大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
git repo中有一个

https://github.com/keephacking/ionic-scrolling-header

它有一切使它兼容aot.但在构建我的应用程序时

ionic build –prod命令,aot build失败,错误如下所示.

[18:02:48]  ngc started ...
[18:02:57]  typescript error
        Unexpected value 'ScrollingHeaderModule in
        xxx/node_modules/ionic-scrolling-header/scrolling-header.module.d.ts' imported by the
        module 'xxxModule in xxx/xxx.module.ts'. Please add a @NgModule
        Annotation.

Error: The Angular AoT build Failed. See the issues above
at xxx\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:237:55
at step (xxx\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:32:23)
at Object.next (xxx\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:13:53)
at fulfilled (xxx\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:4:58)
[18:02:57]  copy finished in 10.69 s

我在Package.json中的依赖项

{
   "dependencies": {
    "@angular/common": "5.2.0","@angular/compiler": "5.2.0","@angular/compiler-cli": "5.2.0","@angular/core": "5.2.0","@angular/forms": "5.2.0","@angular/http": "5.2.0","@angular/platform-browser": "5.2.0","@angular/platform-browser-dynamic": "5.2.0","@ionic-native/core": "4.4.2","@ionic/storage": "2.1.3","es6-promise-plugin": "^4.1.1","firebase": "^4.8.0","ionic-angular": "3.9.2","ionic-plugin-keyboard": "^2.2.1","ionicons": "3.0.0","promise-polyfill": "^7.0.0","rxjs": "5.5.6","sw-toolBox": "3.6.0","zone.js": "0.8.18"
  },"devDependencies": {
    "@angular/cli": "^1.6.3","@ionic/app-scripts": "3.1.7","typescript": "2.6.2"
  }
}

非常好奇地知道那个包中缺少什么.

谢谢

我按照以下步骤操作,它对我有用,希望它可以帮到你

第1步:安装npm install ionic-scrolling-header –sav-dev

步骤2:打开home.moduel.ts文件并从’ionic-scrolling-header’导入此导入{ScrollingHeaderModulE};并且不要忘记在你的导入中添加

imports: [
    ScrollingHeaderModule,IonicPageModule.forChild(HomePagE),],

Step3:在你的home.ts文件里面添加这个@ViewChild(内容)内容内容;

第4步:在home.html页面添加此< ion-header [scrollingHeader] ='content'>

有关更多信息,请查看此link

大佬总结

以上是大佬教程为你收集整理的使用`–prod`在`building中的angular – ionic scrolling header package问题(请添加一个@NgModule注释.)全部内容,希望文章能够帮你解决使用`–prod`在`building中的angular – ionic scrolling header package问题(请添加一个@NgModule注释.)所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。