I’m having trouble getting a basic component to work. Have followed a nunber of tuorials with no luck.
Started by generating a component with "ionic g component testcomp"
Added the import to my app.module.ts, and the module name “Testcomp” to the declaration.
Added the component to my home page html
get error:
Error: Uncaught (in promise): Error: Template parse errors:
‘testcomp’ is not a known element:
I notice that the generator gives me a module file with IonicPageModule in it, no tutorial mentions that.
Any ideas?
versions:
Ionic Framework: 3.1.1
Ionic App Scripts: 1.3.7
Angular Core: 4.0.2
Angular Compiler CLI: 4.0.2
Node: 7.7.3
OS Platform: Windows 10
Navigator Platform: Win32
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36
Yes I checked the selector a few times, tried changing to include a hyphen incase that was important too.
How is the module used for lazy loading then?
Here’s my relavant code sections:-
I’ve tried the same thing on a new app and it works. I’ll compare for tiny differences, but does is make a difference that all my pages are being lazy-loaded?
The custom component must have its own module that is imported by the lazy page’s. Syntax is in this post. Beware that your app binary will end up having extra copies of your component code, one for each page that imports it.
thanks for you help on this subject so far.
I think I’ll go back to having declared pages from the start, I just didn’t like having page references everywhere, feels like a backwards step.