'swiper-container' is not a known element on version 9
Asked Answered
F

4

7

After updating to swiper v9.0.3 it showing

`'swiper-container' is not a known element:

  1. If 'swiper-container' is an Angular component, then verify that it is included in the '@Component.imports' of this component.
  2. If 'swiper-container' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@Component.schemas' of this component to suppress this message.`

Was trying to update swiper in my angular project

Fourwheeler answered 9/2, 2023 at 14:35 Comment(3)
Did you import the SwiperModule in your app.module.ts?Rabbi
Yes, but not worked. It was working on version 8Fourwheeler
I've read a lot of docs and this one helped me. - https://mcmap.net/q/543511/-how-to-use-swiper-9-with-angularPropound
C
7

I have the same problem: according to the page "Migrating from ion-slides to Swiper.js" 9 in the official documentation the schema CUSTOM_ELEMENTS_SCHEMA can be declared globally in app.module.ts, but for me it works only when I declare it in it the module file for each page, e.g., home.module.ts.

So just try to declare "CUSTOM_ELEMENTS_SCHEMA" in your module file, where you want to use it.

Clever answered 11/9, 2023 at 10:4 Comment(1)
I emphasize the point that is th esolution for me : it works only when I declare it in it the module file for each page, e.g., home.module.ts .Horrorstruck
A
1

Swiper Angular components have been removed in v9. If you want to use v9, you need to change your Angular components to web components.

You can start with adding CUSTOM_ELEMENTS_SCHEMA to your app module's schema.

https://swiperjs.com/migration-guide-v9#swiper-angular

Abulia answered 15/2, 2023 at 13:18 Comment(0)
I
1

Expanding on AdmiralBang's answer, I've noticed adding CUSTOM_ELEMENTS_SCHEMA to your module file doesn't eliminate the error. You'd have to restart your CLI and serve the application again.

Also, this works, whether you added it globally or within the template's module file

Iorgos answered 4/1 at 10:17 Comment(0)
L
0

This

run ionic capacitor sync

worked for me.

Lepp answered 29/5 at 14:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.