i'm trying to implement ion2-calendar from
https://github.com/hsuanxyz/ion2-calendar
but when i trying to imported to my app.module.ts
i get this error :
Uncaught Error: Cannot find module "#ionic/angular"
at webpackMissingModule (calendar.modal.js:13)
at Object.<anonymous> (calendar.modal.js:13)
at __webpack_require__ (bootstrap ff18038c92faa82fd673:54)
at Object.<anonymous> (index.js:7)
at __webpack_require__ (bootstrap ff18038c92faa82fd673:54)
at Object.355 (main.ts:5)
at __webpack_require__ (bootstrap ff18038c92faa82fd673:54)
at Object.332 (main.ts:1)
at __webpack_require__ (bootstrap ff18038c92faa82fd673:54)
at webpackJsonpCallback (bootstrap ff18038c92faa82fd673:25)
my app.module.ts
import { BrowserModule } from '#angular/platform-browser';
import { ErrorHandler, NgModule } from '#angular/core';
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
import { SplashScreen } from '#ionic-native/splash-screen';
import { StatusBar } from '#ionic-native/status-bar';
import { MyApp } from './app.component';
import { HomePage } from '../pages/home/home';
import { Http, Headers, RequestOptions, HttpModule } from '#angular/http';
import { CalendarModule } from 'ion2-calendar';
#NgModule({
declarations: [
MyApp,
HomePage
],
imports: [
BrowserModule,HttpModule,
IonicModule.forRoot(MyApp),
CalendarModule
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
HomePage
],
providers: [
StatusBar,
SplashScreen,
{provide: ErrorHandler, useClass: IonicErrorHandler}
]
})
export class AppModule {}
don't know what's wrong
Looks like you've downloaded the ionic 4 version of the library. Try using https://github.com/HsuanXyz/ion2-calendar/tree/v2 this version is set up for ionic-angular not #ionic/angular which it looks like your verson is. Hope this helps :)
Related
I have added QQoutesPage in Ionic, if I add in app.modules.ts at the #NgModule list I am getting the Error saying
QQoutesPage is part of the declarations of 2 modules: AppModule and
QQoutesPageModule!*
if I remove the QQoutesPages from the #NgModules list I am getting --
Error: Component QQoutesPage is not part of any NgModule or the module
has not been imported into your module.
app/modules.ts
import { BrowserModule } from '#angular/platform-browser';
import { ErrorHandler, NgModule } from '#angular/core';
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
import { SplashScreen } from '#ionic-native/splash-screen';
import { StatusBar } from '#ionic-native/status-bar';
import { MyApp } from './app.component';
import { FavoritesPage } from '../pages/favorites/favorites';
import { LibraryPage } from '../pages/library/library';
import { QuotePage } from '../pages/quote/quote';
import { SettingsPage } from '../pages/settings/settings';
import { tabsPage } from '../pages/tabs/tabs';
import { QQoutesPage } from '../pages/q-qoutes/q-qoutes';
import { QuotesServices } from '../services/quotes';
#NgModule({
declarations: [
MyApp,
FavoritesPage,
LibraryPage,
QuotePage,
SettingsPage,
tabsPage ,QQoutesPage,
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
FavoritesPage,
LibraryPage,
QuotePage,
SettingsPage,
tabsPage
],
providers: [
StatusBar,
SplashScreen,
{provide: ErrorHandler, useClass: IonicErrorHandler},
QuotesServices,QQoutesPage
]
})
export class AppModule {}
Error:
I am facing a problem when I run the code via ionic serve
I get an error of
Runtime error: Cannot find module "."
App.module.ts
import { BrowserModule } from '#angular/platform-browser';
import { ErrorHandler, NgModule } from '#angular/core';
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
import { SplashScreen } from '#ionic-native/splash-screen';
import { StatusBar } from '#ionic-native/status-bar';
import { MyApp } from './app.component';
import { SigninPage } from '../pages/auth/signin/signin';
import { SignupPage } from '../pages/auth/signup/signup';
import { LandingPage } from '../pages/landing/landing';
import { AuthService } from '../services/auth.service';
#NgModule({
declarations: [
MyApp,
SigninPage,
SignupPage,
LandingPage
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp)
],
providers: [
StatusBar,
SplashScreen,
AuthService,
{provide: ErrorHandler, useClass: IonicErrorHandler}
]
I haven't mention the entrycomponents
and all the components contains the default code. AuthService is also empty
If I remove the AuthService form Providers in app.module file Code runs succesfully. But if I have to access the authService I must provide it in the Providers
IonicPageModule is missing from your project.
In your app.module.ts include
import { IonicPageModule } from 'ionic-angular';
And your import should looks like this:
imports: [
BrowserModule,
IonicPageModule.forChild(HomePage)
IonicModule.forRoot(MyApp)
],
after that run npm run-script build
NOTE: IonicPageModule is an NgModule that bootstraps a child IonicPage in order to set up routing.
I'm new to Ionic and experiencing the following error when I inject HttpClient into my service class:
Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[CategoriesServiceProvider -> HttpClient]:
StaticInjectorError(Platform: core)[CategoriesServiceProvider -> HttpClient]:
NullInjectorError: No provider for HttpClient!
Error: StaticInjectorError(AppModule)[CategoriesServiceProvider -> HttpClient]:
StaticInjectorError(Platform: core)[CategoriesServiceProvider -> HttpClient]:
NullInjectorError: No provider for HttpClient!
The error is triggered by the following Service class:
import { HttpClient } from '#angular/common/http';
import { Injectable } from '#angular/core';
#Injectable()
export class CategoriesServiceProvider {
apiURL = 'https://randomuser.me/api/?results=10';
constructor(private http: HttpClient) {
console.log('Hello CategoriesServiceProvider Provider');
}
}
If I remove the HttpClient from the constructor, the error goes away.
And, the following is my app.module.ts code:
import { BrowserModule } from '#angular/platform-browser';
import { ErrorHandler, NgModule } from '#angular/core';
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
import { SplashScreen } from '#ionic-native/splash-screen';
import { StatusBar } from '#ionic-native/status-bar';
import { MyApp } from './app.component';
import { TabsPage } from '../pages/tabs/tabs';
import { CategoriesPage } from '../pages/categories/categories';
import { SubscriptionsPage } from '../pages/subscriptions/subscriptions';
import { CategoriesServiceProvider } from '../providers/categories-service/categories-service';
#NgModule({
declarations: [
MyApp,
TabsPage,
CategoriesPage,
SubscriptionsPage
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
TabsPage,
CategoriesPage,
SubscriptionsPage
],
providers: [
StatusBar,
SplashScreen,
{provide: ErrorHandler, useClass: IonicErrorHandler},
CategoriesServiceProvider
]
})
export class AppModule {}
Any insights will be appreciated.
Add import { HttpClientModule } from '#angular/common/http'; in your app module.
In imports, add HttpClientModule like:
imports: [
BrowserModule,
HttpClientModule,
IonicModule.forRoot(MyApp)
]
Why do I get this error?
Error: No component factory found for DatabaseProvider. Did you add it
to #NgModule.entryComponents?
I tried to add my provider to the entryComponents, but still not working.
database.ts
import { HttpClient } from '#angular/common/http';
import { Injectable } from '#angular/core';
import { Storage } from '#ionic/storage';
#Injectable()
export class DatabaseProvider {
localData: any;
constructor() {
console.log('Database provider iniciado ..');
}
}
My settings
, With this provider i'm trying to make a local storage, but I can't use this provider.
app.module.ts
import { NgModule, ErrorHandler } from '#angular/core';
import { BrowserModule } from '#angular/platform-browser';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import { MyApp } from './app.component';
import { StatusBar } from '#ionic-native/status-bar';
import { SplashScreen } from '#ionic-native/splash-screen';
import { DatabaseProvider } from '../providers/database/database';
import { IonicStorageModule } from '#ionic/storage';
#NgModule({
declarations: [
MyApp,
InicioPage,
SimuladorPage,
NosotrosPage,
CuestionarioPage,
CuestinarioPorCompetenciaPage,
PersonalizadoPage,
CRUDPage,
NormasPage,
CategoriasPage,
VerCategoriasPage,
PreguntasPage,
AlternativasPage,
FeedbackPage
],
imports: [
BrowserModule,
IonicModule.forRoot(DatabaseProvider),
IonicStorageModule.forRoot()
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
InicioPage,
SimuladorPage,
NosotrosPage,
CuestionarioPage,
CuestinarioPorCompetenciaPage,
PersonalizadoPage,
CRUDPage,
NormasPage,
CategoriasPage,
VerCategoriasPage,
PreguntasPage,
AlternativasPage,
FeedbackPage
],
providers: [
StatusBar,
SplashScreen,
{provide: ErrorHandler, useClass: IonicErrorHandler},
DatabaseProvider
]
})
export class AppModule {}
I just had to make a new project ....
I have an Ionic 2 application where I make use of Storage.
When I start the app, it crashes with the error message: Can't resolve all parameters for Storage: (?, ?).
I can't seem to find the error, who can help me?
app.module.ts
import { NgModule, ErrorHandler } from '#angular/core';
import { BrowserModule } from '#angular/platform-browser';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import { MyApp } from './app.component';
import { Storage } from '#ionic/storage';
import { AboutPage } from '../pages/about/about';
import { ContactPage } from '../pages/contact/contact';
import { HomePage } from '../pages/home/home';
import { EthylenePage } from '../pages/ethylene/ethylene';
import { PropylenePage } from '../pages/propylene/propylene';
import { TemporaryResultPage } from '../pages/temporary-result/temporary-result';
import { TabsPage } from '../pages/tabs/tabs';
import { StatusBar } from '#ionic-native/status-bar';
import { SplashScreen } from '#ionic-native/splash-screen';
#NgModule({
declarations: [
MyApp,
AboutPage,
ContactPage,
EthylenePage,
PropylenePage,
TemporaryResultPage,
HomePage,
TabsPage
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp),
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
AboutPage,
ContactPage,
PropylenePage,
EthylenePage,
TemporaryResultPage,
HomePage,
TabsPage
],
providers: [
{provide: ErrorHandler, useClass: IonicErrorHandler},
StatusBar,
SplashScreen,
Storage
]
})
export class AppModule {}
In my package.json I have added this to my dependencies section:
"#ionic/storage": "1.1.7"
Please check this http://ionicframework.com/docs/storage/
The documentation state
import { IonicStorageModule } from '#ionic/storage';
and
imports: [
BrowserModule,
IonicModule.forRoot(MyApp),
IonicStorageModule.forRoot()
],
You don't need to add Storage on providers part