Тёмный

Using Custom Components on Multiple Pages in Ionic 

Joshua Morony
Подписаться 74 тыс.
Просмотров 46 тыс.
50% 1

In this tutorial, we take a look at some common pitfalls when using custom components and how you can use custom components across multiple pages when using lazy loading in an Ionic/Angular application.
#ionic #angular #components
- Learn Ionic: www.joshmorony.com/building-m...
- Find me on Twitter: / joshuamorony
- More Ionic tutorials: www.joshmorony.com/blog/

Опубликовано:

 

16 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 158   
@nirliptgaur
@nirliptgaur 5 лет назад
Just another Thank You message among the above millions. I am teaching ionic 4 to some interns and your videos give them clarity. I just love the way you first take a normal approach, and then when the error pops up, like it does for us, you show the actual way things need to be coded. Excellent Effort. Hope Ionic Team hires you :P
@MurilloVieira
@MurilloVieira 5 лет назад
Man, you're just awesome. I've spent a lot of time trying to figure out how normal angular components should work for ionic 4 and you've just lit my way. Thanks a lot!!
@muhammadshahrez2130
@muhammadshahrez2130 4 года назад
Thank God I found you at the right time. I was banging my head figuring out what was wrong with my component and you litterally saved me from a nightmare.
@gianlucacau5907
@gianlucacau5907 4 года назад
You just saved me a lot of time that would have been wasted! Thanks man, speaking of Ionic you sure are the best!
@denisgarcia01
@denisgarcia01 4 года назад
Thanks. The main fix for me was the explanation about the lazy loading not loading components. That made my day. Thank you!
@olumideayeni143
@olumideayeni143 4 года назад
Josh!!!..... Thank you, you really saved my day with this... I am so glad that i found this at the right now.
@simonsutherland15
@simonsutherland15 4 года назад
I was going around in circles, reading and re-reading documentation & examples (mostly of non-lazy loaded components) No i not only know what to do, but _why_ This was a life saver!
@sergijonama1748
@sergijonama1748 4 года назад
Nice tutorial thanks! In Ionic 4 you should add some extra imports to avoid template parse errors. import { SyncIconComponent } from './sync-icon/sync-icon.component'; import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { IonicModule } from '@ionic/angular'; @NgModule({ imports: [CommonModule, IonicModule],
@acarolsfs
@acarolsfs 4 года назад
Thanks man! You saved my life
@oswaldkit
@oswaldkit 4 года назад
Thanks man! You saved my life too.
@buraksimsek2471
@buraksimsek2471 2 года назад
Thanks man! You saved my life too. By the way, I encountered this in Ionic 6.
@f1234411231
@f1234411231 Год назад
Thanks man! You saved my life too.
@shaunbrassell68
@shaunbrassell68 3 года назад
Great video - taking one through the failure process was key to me learning, excellent job!
@muzz88
@muzz88 5 лет назад
Nice one, I was convinced I was never going to use shared components in ionic until this. Thanks
@rodrigomgsys
@rodrigomgsys 4 года назад
Great tutorial, It has worked perfectly for me. I was facing this error when tried to load a custom component in a PageModule. Thank you very much for sharing. :-)
@mohammadhadiemami2670
@mohammadhadiemami2670 4 года назад
you saved 2 hours of my time!! THANKS
@grab0wski
@grab0wski 5 лет назад
Thank you Joshua Morony, you saved my day, I spended amount of time this morning to resolv this issue =))
@vp3275
@vp3275 5 лет назад
Great quality, you deserve mor views :) Thanks !
@mekbeb
@mekbeb 4 года назад
Thanks Josh, nice quick and easy explanation. God bless!
@aliciajanssen6548
@aliciajanssen6548 5 лет назад
Thank you! The instructions are fantastic!
@sathvikakopalli2574
@sathvikakopalli2574 Год назад
That was really a great explanation you have helped me a lot bro 🙌🙌 Hope you continue doing lectures like these 🥺
@fcsalmeida
@fcsalmeida 5 лет назад
Thank you! You are the man! It saved me from a big problem !!
@sapsapproductivity
@sapsapproductivity 2 года назад
Thanks Joshua, Well explained.
@jeffcordova
@jeffcordova 5 лет назад
Josh! Thank you for this! Thank you for saving me again. :)
@kyatar
@kyatar 3 года назад
you just made my day, thanks for the awesome explanation
@tendaikatsande7578
@tendaikatsande7578 3 года назад
You saved my life, I had to also add other modules, like ionicModule, RoutingMoudle to the shared module
@zhoobinjalili5946
@zhoobinjalili5946 2 года назад
Great, helped me a lot! Thanks Joshua!
@yorlandIII
@yorlandIII 2 года назад
Amazing!! thank you for the detailed explanation!!
@allan9537
@allan9537 4 года назад
Thank you so much! Saved my day!!
@AcquahEmmanuelBaiden
@AcquahEmmanuelBaiden 2 года назад
Thanks Joshua. This was very useful
@doronsayar1587
@doronsayar1587 8 месяцев назад
Thanks man, you saved me from a mental breakdown!
@crassProgrammer
@crassProgrammer 2 года назад
This was what exactly I wanted. Thankyou very much!!
@youngwise14
@youngwise14 4 года назад
Thanks man! This was right on time.
@Garciia
@Garciia 2 года назад
Hey still useful, I've been trying to get into it and this clear my head around the subject, ty
@muhammadhussainn4389
@muhammadhussainn4389 5 лет назад
Thank you for this video!
@jesusdcg7583
@jesusdcg7583 4 года назад
Well explained, thank you
@izzatullokanoatov370
@izzatullokanoatov370 4 года назад
I will take off my hat in front of your tutorials. Best of the best.
@emartosgomez
@emartosgomez 4 года назад
Thank you so much! Really useful!
@erna3477
@erna3477 5 лет назад
Saved my night... Thank you!
@videodr.9402
@videodr.9402 4 года назад
Thanks, Joshua Morony, you saved my day :)
3 года назад
Thanks for the video!
@lesetjalese7462
@lesetjalese7462 2 года назад
Thanks this really saved my day.
@argieabedejos760
@argieabedejos760 3 года назад
Thanks man. This saves my day.
@joseduvanrubianoperalta1632
@joseduvanrubianoperalta1632 5 лет назад
Good tutorial, thanks.
@VinayKumar-bl2ob
@VinayKumar-bl2ob Год назад
Thanks a lot, you are great at explaining👍👍👍
@ciaranmooney1912
@ciaranmooney1912 2 года назад
Very useful video, thanks
@DavidHodges47
@DavidHodges47 5 лет назад
This really solved my problem. Most of the other results from Google searching were wrong about this, possibly due to changes in versions of ionic or angular. I do wish that you could make the source code for this one example available on github or something similar. Also, when you use "ionic generate module", it generates a "spec" file, which throws errors unless you delete it.
@rStudius
@rStudius 3 года назад
Thanks a lot! Helped me so muuuch
@tpamarasekera
@tpamarasekera 4 года назад
Great tutorial! !!!!!
@joeporsche1767
@joeporsche1767 3 года назад
You just save my day. Thank!!!
@Sandeep-vr8ri
@Sandeep-vr8ri 4 года назад
nice and simple , thanks bro.
@magicalkunal
@magicalkunal 2 года назад
Thanks. it helped me a lot.
@jacobsultd
@jacobsultd 3 года назад
Thank you Joshua. Saved me..
@walaazahran29
@walaazahran29 Год назад
thanks you helped me so much !
@Iam_AndersonP
@Iam_AndersonP 2 года назад
Grat tutorial. Another thing in cosideration is that the ionic cli has a more easy way to crete a shared module. You just hast to run the command ionic g module shared (or wharever name you want) and it will create the module with the necesary structure you need
@rudikatzer1606
@rudikatzer1606 2 года назад
Amazing. Works for me in 2022
@yccodei
@yccodei 3 года назад
Thanks a lot for your help
@taha5049
@taha5049 Год назад
Thanks Good Lad you Saved my day!!
@bankoleemmanuel1088
@bankoleemmanuel1088 5 лет назад
Thanks Joshua
@mojinzhang2250
@mojinzhang2250 4 года назад
super helpful thanks!
@zeerodev
@zeerodev 5 лет назад
Thanks alot for this solution
@developpeuranonyme9428
@developpeuranonyme9428 5 лет назад
Thank you very much, that helped me a lot :)
@nileshupadhyay7248
@nileshupadhyay7248 4 года назад
Hey Josh thanks a lot buddy, you saved my time.... Yes I really enjoyed the tutorial.. :)
@WajahathKhan04
@WajahathKhan04 5 лет назад
Thanks Man, 1000 Likes :) You just give me the result of my struggling 5 hrs
@MOHAMMEDSOKAILY
@MOHAMMEDSOKAILY 4 года назад
Thank you, you saved my day
@Karthik1516
@Karthik1516 4 года назад
I had the exact same error. Thank you.
@wealth_developer_researcher
@wealth_developer_researcher 3 года назад
Thanks!!! It helped me :)
@DieDie-us4oo
@DieDie-us4oo 4 года назад
Thank you man!!
@luisdonis2147
@luisdonis2147 4 года назад
Thank you sooooo much!!!
@MounikaUmmidi
@MounikaUmmidi 11 месяцев назад
Thank you !
@elmergarcia.a5536
@elmergarcia.a5536 4 года назад
thank you!!
@psv6009
@psv6009 4 года назад
Thanks too much your video, you solved ' 2 modules' for me.
@ThukuWakogi
@ThukuWakogi 4 года назад
You saved a life sir
@serhiyhrabovy510
@serhiyhrabovy510 3 года назад
thank you!
5 лет назад
Great tutorial! If you're thinking about a new one, can you please make a tutorial about importing JavaScript or npm packages to Ionic 4? The other day I needed to import Bson to my Ionic 4 project but I had a bunch of errors and I quit.
@kinetik2018
@kinetik2018 5 лет назад
muchas gracias !!!
@andriyzhuk8830
@andriyzhuk8830 4 года назад
Thanks!
@27brenner
@27brenner 3 года назад
THANK YOU
@chularansifernando5
@chularansifernando5 5 лет назад
Thank you, I also need to know how to use one page on multiple pages in ionic 4? Could you please add another video for that.
@RahulYadav-hs2un
@RahulYadav-hs2un 4 года назад
Nice Video
@Arudion
@Arudion 5 лет назад
Additional: - If you want to use nested components, you have to add them to the entryComponents of the ComponentsModule - If you want to use Ionic Components, you have to add IonicModule to the imports of the ComponentsModule
@babyamg
@babyamg 5 лет назад
Example: const tmpModule = NgModule({ declarations: [tmpCmp], imports:[IonicModule], entryComponents: [tmpCmp], })(class {});
@MarioShtika
@MarioShtika 4 года назад
​and also if you want to use things like `*ngIf` you should import `BrowserModule`, but because this is already imported on app.module.ts you should import `CommonModule` instead `imports: [IonicModule, CommonModule],`
@karlzone2
@karlzone2 4 года назад
I should have read your comment @Mario, god damn. But yeah, if you wanna use NgFor, NgIf, then do :import { CommonModule } from '@angular/common';
@philipvandrunen3728
@philipvandrunen3728 5 лет назад
Thank you, thank you, thank you. I still don't completely understand, but at least my code is working again!
@thellecodes
@thellecodes 4 года назад
Nice One
@carlosgaleanohn
@carlosgaleanohn 5 лет назад
Is more easy than Ionic 3... TY for the explaining it!
@manarmohammad8232
@manarmohammad8232 Год назад
thank you
@LongNguyen-bj3ud
@LongNguyen-bj3ud 5 лет назад
Thank Bro ^^
@SajalSuraj
@SajalSuraj 3 года назад
This helped :)
@calina9939
@calina9939 4 года назад
pretty Josh thks x)
@devinvail67
@devinvail67 5 лет назад
As always, love your tutorials. In this one you added background music, not sure why. I found it distracting. Following your voice and the code is enough data to handle for my brain :-)
@HOW-bt3et
@HOW-bt3et 2 месяца назад
thanks man
@sebasA
@sebasA 3 года назад
Hi thanks for the video, Im using the Ionic side-bar template and in a page I desided to add a component just like you with a module, the problem is the sidebar cant be slide if mi finger pass trough the component. For fix it I just reduced the component area to slide the sidebar but the sidebar looks lagy (just happen in the page where I added the component).
@jluis859
@jluis859 4 года назад
saved my life
@cdevidal
@cdevidal 4 года назад
Appreciate it! I should have checked your video first :-)
@Cheikna98
@Cheikna98 5 лет назад
Merci beaucoup
@israelnunesoriente7722
@israelnunesoriente7722 3 года назад
VOCE É Incrivellll
@jamesdavidwyers9110
@jamesdavidwyers9110 2 года назад
1:01 Glad I'm not the only one with this problem....😅
@daveycrockettjr
@daveycrockettjr 5 лет назад
When using a custom component on multiple pages I notice that the component is created again (or at least ngInit() fires again). Is there a way to make a component that is at the root level and is not re-created if used on two pages?
@ginil
@ginil 4 года назад
in the ionic 4 conference app, there aren't any components, just pages. Is it possible to include a page in another page, just like a component?
@comformarkwebsite8833
@comformarkwebsite8833 5 лет назад
Thanks Joshua, another excellent explanation! Can you perhaps create an additional video that explains how to use a component within a component? Or, how to add a component to a page that was created as a component - ie. Using a component as a page, so the router points to "component: MyPageComponent" - now MyPageComponent doesn't have a module, so how do I add custom components to it? (This process works in Angular 7, but "does my head in" using Ionic 4 ! )
@zsearthas
@zsearthas 4 года назад
from 7:09 solution starts, skip before
@sukdipkar8876
@sukdipkar8876 3 года назад
how can use the component.css file in the page?
@jesseb0rn51
@jesseb0rn51 2 года назад
Sadly youtube doesn't have the dislike button anymore, otherwise 12 minutes of my life would have been saved
@JosephAli93
@JosephAli93 5 лет назад
I think i follow tutorial step by step, but got ERROR Error: "Uncaught (in promise): Error: Unexpected module 'TestComponentPageModule' declared by the module 'TestComponentPageModule'. Please add a @Pipe/@Directive/@Component annotation.
@sarath9077
@sarath9077 5 лет назад
Thank you so much Joshua. I have one question though. System throws error when I use ion elements like ion-item etc inside my custom component. How do we solve that issue?
@sarath9077
@sarath9077 5 лет назад
Update: It got fixed by adding CUSTOM_ELEMENTS_SCHEMA in the schema of component.module.ts. schemas: [ CUSTOM_ELEMENTS_SCHEMA ],
@karlzone2
@karlzone2 4 года назад
Sorry, I know this is five months late, but do you know why this happens? I used loads of ion elements, but didn't get this error, though I saw someone on a forum suggesting your solution. What does CUSTOM_ELEMENTS_SCHEMA do? It's clearly important (or at least it used to be?)?!