rossmartin / ionic2-alpha-scroll

:arrow_up_down: :capital_abcd: Configurable Ionic 2 component for alphabetically indexed list with an alpha scroll bar.
MIT License
66 stars 22 forks source link

main.js:55857 EXCEPTION: Error in ./IonAlphaScroll class IonAlphaScroll - inline template:1:9 caused by: Type MapToIterable is... #10

Closed Damzou closed 7 years ago

Damzou commented 7 years ago

Hello, i am using ionic2-alpha-scroll and i have a bug. First time i am entering on page, there are no problem, but if i click on back and i reetering on page i have error (see the screen). error

Do you have an issue tho solve this problem ? THX !

rossmartin commented 7 years ago

This component isn't compatible with Ionic 2 rc.4 yet if you are using it. Can you show me your output to the ionic info CLI command?

Damzou commented 7 years ago

hey !

Cordova CLI: 6.4.0 Ionic Framework Version: 2.0.0-rc.4 Ionic CLI Version: 2.1.17 Ionic App Lib Version: 2.1.7 Ionic App Scripts Version: 0.0.48 ios-deploy version: Not installed ios-sim version: Not installed OS: OS X El Capitan Node Version: v6.9.1 Xcode version: Xcode 8.1 Build version 8B62

arf ionic 2 rc.4 :'(

rossmartin commented 7 years ago

I should get some time this weekend to get this component updated. Honestly though I might wait until Ionic 2 is stable - nearly every update has introduced some issue and hurdle for compatibility.

xindexer commented 7 years ago

I tried to fix this myself this morning but I don't understand modules well enough. I have found where the issue is though - on the second load of the module, the DynamicComponentModule is redeclaring MapToIterable which throws the error shown above.

Now that Ionic 2.0.0 is out - any chance you could spend a few minutes on this and making it work under the new version?

Thanks

rossmartin commented 7 years ago

@xindexer @Damzou

This issue should be resolved in the latest version (1.0.9) - Please read the note about the known issue with AoT compiling though.

xindexer commented 7 years ago

Still getting the same error - did a fresh install

I did see the changes in the new version but didn't fix it

Runtime Error Error in ./IonAlphaScroll class IonAlphaScroll - caused by: Type MapToIterable is part of the declarations of 2 modules: and ! Please consider moving MapToIterable to a higher module that imports and . You can also create a new NgModule that exports and includes MapToIterable then import that NgModule in and . Stack Error: Type MapToIterable is part of the declarations of 2 modules: and ! Please consider moving MapToIterable to a higher module that imports and . You can also create a new NgModule that exports and includes MapToIterable then import that NgModule in and . at CompileMetadataResolver._addTypeToModule (http://localhost:8101/build/main.js:31561:19) at http://localhost:8101/build/main.js:31478:27 at Array.forEach (native) at CompileMetadataResolver._loadNgModuleMetadata (http://localhost:8101/build/main.js:31462:54) at CompileMetadataResolver.loadNgModuleMetadata (http://localhost:8101/build/main.js:31385:29) at RuntimeCompiler._loadModules (http://localhost:8101/build/main.js:48007:41) at RuntimeCompiler._compileModuleAndAllComponents (http://localhost:8101/build/main.js:47991:35) at RuntimeCompiler.compileModuleAndAllComponentsAsync (http://localhost:8101/build/main.js:47973:21) at ModuleBoundCompiler.compileModuleAndAllComponentsAsync (http://localhost:8101/build/main.js:48287:31) at DynamicComponentDirective.ngOnChanges (http://localhost:8101/build/main.js:87746:23) Ionic Framework: 2.0.0 Ionic Native: 2.4.1 Ionic App Scripts: 1.0.0 Angular Core: 2.2.1 Angular Compiler CLI: 2.2.1 Node: 6.9.2 OS Platform: macOS Sierra Navigator Platform: MacIntel User Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1

rossmartin commented 7 years ago

@xindexer

Can you post the contents of your src/app/app.module.ts ?

xindexer commented 7 years ago

import { NgModule, ErrorHandler } from '@angular/core'; import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular'; import { MyApp } from './app.component'; import { AboutPage } from '../pages/about/about'; import { ContactPage } from '../pages/contact/contact'; import { HomePage } from '../pages/home/home'; import { TabsPage } from '../pages/tabs/tabs'; import { IonAlphaScrollModule } from 'ionic2-alpha-scroll' import { AlphaListPage } from '../pages/alpha-list/alpha-list'

@NgModule({ declarations: [ MyApp, AboutPage, ContactPage, HomePage, TabsPage, AlphaListPage ], imports: [ IonicModule.forRoot(MyApp), IonAlphaScrollModule ], bootstrap: [IonicApp], entryComponents: [ MyApp, AboutPage, ContactPage, HomePage, TabsPage, AlphaListPage ], providers: [{provide: ErrorHandler, useClass: IonicErrorHandler}] }) export class AppModule {}

rossmartin commented 7 years ago

@xindexer Strange - I can't reproduce the issue in my example, can you?

xindexer commented 7 years ago

The example works fine - however, this error occurs when you load a page for the second time...notice that in my app-module.ts I have the alpha list outside of the tabs pages? when you load the alpha-list page the first time - works great - when you load it the second time you get the error. Looks like the module is being re-instantiated and in the process the MapToIterate is getting declared for a second time

rossmartin commented 7 years ago

@xindexer Thanks for providing the info and steps - I'll be looking into it.

xindexer commented 7 years ago

In regards to the AOT issue - I'm installing the ng2-translate module and ran across this:

"If you want to configure a custom TranslateLoader while using AoT compilation, you must use an exported function instead of an inline function"

This is regards to the @NgModule imports - I saw that you are importing the DynamicComponentModule using .forRoot() which is very similar to the TranslateLoader issue. Maybe your problem is there?

https://github.com/ocombe/ng2-translate#usage (under the AoT)

rossmartin commented 7 years ago

@xindexer @Damzou This is now fixed in 1.1.0