There is a package in the git repo
https://github.com/keephacking/ionic-scrolling-header
which has every thing to make it compatible for aot . But while building my app with
ionic build --prod
command , aot build fails with error shown below.
[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
My dependencies in 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"
}
}
Very curious to know whats missing in that package.
Thanks
I followed the below steps and it worked for me hope it helps you
Step 1: install npm install ionic-scrolling-header --sav-dev
Step2: Open Your home.moduel.ts
file and import this import {ScrollingHeaderModule} from 'ionic-scrolling-header';
and don't forget to add this inside your imports
imports: [
ScrollingHeaderModule,
IonicPageModule.forChild(HomePage),
],
Step3: Inside your home.ts file add this @ViewChild(Content) content: Content;
Step 4: inside your home.html page add this <ion-header [scrollingHeader]='content'>
For more information check this link
I have fixit with follow steps:
0-Download project from author repository
1-Rename "src" folder to "ionic-scrolling-header", and copy to your directive(folder)
2-Create a directive folder inside src (folder)
3-Change import in your app.module.ts, as you can see on my print:
screenshot
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With