'Ion-text' is not a known element

#1

Hi All,
I am trying to use ion-item example as given in https://ionicframework.com/docs/api/item

                <ion-label text-wrap>
                    <ion-text color="primary">
                        <h3>H3 Primary Title</h3>
                    </ion-text>
                    <p>Paragraph line 1</p>
                    <ion-text color="secondary">
                        <p>Paragraph line 2 secondary</p>
                    </ion-text>

But it says -

'ion-text' is not a known element:
1. If 'ion-text' is an Angular component, then verify that it is part of this module.
2. If 'ion-text' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("
                <ion-label text-wrap>

                    [ERROR ->]<ion-text color="primary">

                        <h3>H3 Primary Title</h3>
"): ng:///AppModule/Dashboard.html@58:20
'ion-text' is not a known element:
1. If 'ion-text' is an Angular component, then verify that it is part of this module.
2. If 'ion-text' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("
                    <p>Paragraph line 1</p>

                    [ERROR ->]<ion-text color="secondary">

Not sure where is the Problem :disappointed_relieved:

below is my ionic info output

Ionic:

   ionic (Ionic CLI)  : 4.6.0 (C:\Users\rahjain\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.1.10

Cordova:

   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : android 7.1.4, browser 5.0.4
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 1.2.1, (and 10 other plugins)

System:

   NodeJS : v10.6.0 (C:\Program Files\nodejs\node.exe)
   npm    : 6.1.0
   OS     : Windows 10

What am i doing wrong ?

#2

Hi @rahjain

I think ion-text component is only available on Ionic 4 projects.
You are using version 3.x.

Irving.

1 Like
#3

Thanks @irvingprog for this information.
I am very new to ionic.
Is it good to upgrade ionic from 3.x to 4 ?

#4

@rahjain

If you are just starting a new project and learning i recommend using Ionic 4.

If your maintaining a project that was made using Ionic 3.x you should see how much customized is and research what things of those are not too easy to do with Ionic 4 that were with ionic 3.x, in order to have a perspective about upgrading.