Having trouble with the @ngModule annotation in Angular 5? Let's find a solution

I recently integrated the selectsearchable package into my project and encountered a strange issue. Initially, everything seemed to work fine on the web and even with the ionic cordova build android command. However, when I attempted to compile the project using

ionic cordova build android --prod
, I received an error message.

   Please add @Ngmodule Annotation

An error occurred: Unexpected value 'SelectSearchableModule in D:/MdAshiff/Ionic/ionic/node_modules/ionic-select-searchable/source/select-searchable.module.d.ts' imported by the module 'AppModule in D:/MdAshiff/Ionic/ionic/src/app/app.module.ts'. Please add a @NgModule annotation.

app.module.ts

    import { NgModule, ErrorHandler } from '@angular/core';
    import { IonicApp, IonicModule, IonicErrorHandler, NavController } from 'ionic-angular';
    import { Geolocation } from '@ionic-native/geolocation';
    import { AppMinimize } from '@ionic-native/app-minimize';
    import { OpenNativeSettings } from '@ionic-native/open-native-settings';
    import { MyApp } from './app.component';
    import { Ionic2RatingModule } from 'ionic2-rating';
    import { NativeStorage } from '@ionic-native/native-storage';
    import { SplashScreen } from '@ionic-native/splash-screen'
    import { CallNumber } from '@ionic-native/call-number';
    import { Push, PushObject, PushOptions } from '@ionic-native/push';
    import { LocalNotifications } from '@ionic-native/local-notifications';
    import { Diagnostic } from '@ionic-native/diagnostic';
    import { HomePage } from '../pages/home/home';
    import { BrowserModule } from '@angular/platform-browser';
    import { HttpModule } from '@angular/http';
    import { SelectSearchableModule } from 'ionic-select-searchable';

    @NgModule({
      declarations: [
        MyApp,
        HomePage   

      ],
      imports: [
          IonicModule.forRoot(MyApp),
          Ionic2RatingModule,
          BrowserModule,
          HttpModule,
          SelectSearchableModule

      ],
      bootstrap: [IonicApp],
      entryComponents: [
        MyApp,
          loginPage,
          dashboardPage,
          ActivitiesPage,
          InvoicePage,
          feedbackPage,
          samplePage,
          locationUpdatePage,
          scopeofworkPage,
          SchedulePage,
          waypointPage

      ],
      providers:
      [
          Geolocation,
          NativeStorage,
          OpenNativeSettings,
          CallNumber,
          Push,
          LocalNotifications,
          Diagnostic,
          {
              provide: ErrorHandler, useClass: IonicErrorHandler

          },
          SplashScreen,
          AppMinimize  ]
    })
    export class AppModule {}

tsconfig.json

{
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "declaration": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [
      "dom",
      "es2015"
    ],
    "module": "es2015",
    "moduleResolution": "node",
    "sourceMap": true,
    "target": "es5"
  },
  "angularCompilerOptions": {
    "skipTemplateCodegen": true,
    "skipMetadataEmit": false,
    "strictMetadataEmit": true,
    "annotationsAs": "decorators"
  },
  "include": [
    "src/**/*.ts"
  ],
  "exclude": [
    "node_modules"
  ],
  "compileOnSave": false,
  "atom": {
    "rewriteTsconfig": false
  },
  "paths": {
    "@angular/*": [
      "../node_modules/@angular/*"
    ]
  }
}

package.json

**

{
  "name": "Md",
  "author": "",
  "homepage": "",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve",
    "watch": "ionic-app-scripts watch"

  },
  "dependencies": {
    // all the dependencies listed here
  },
  "devDependencies": {
    // all the dev dependencies listed here
  },
  "description": "Ionic2Blank: An Ionic project",
  "cordovaPlugins": [
    // cordova plugins
  ],
  "cordovaPlatforms": [],
  "-vs-binding": {
    // BeforeBuild steps
  },
  "cordova": {
    // cordova configurations
  }
}

**

I have looked into various solutions but seem to be missing something. Below are the versions of the key components used:

Ionic 3 Cordova android: 6.3.0 Cordova: 7.1.0

For the rest of the versions, please refer to the package.json file. Any suggestions or solutions?

Answer №1

The issue has been resolved by the creator:

Upgrade the library to version 1.0.8

npm install <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="01686e6f68622c72646d6462752c72646073626960636d6441302f312f39">[email protected]</a>

https://github.com/eakoriakin/ionic-select-searchable-demo

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Retrieve data from the controller of the selected element on the subsequent page using AngularJS

Currently, I am in the process of developing an ecommerce platform using angularjs. In my controller, I have a list of various products structured like this: $scope.products = [ {imgLink: 'product1.jpg', name: 'Wingtip Cognac Oxford&apo ...

Methods for transforming a TypeScript class instance containing getter/setter properties into a JSON format for storage within a MySQL database

I am currently working on a TypeScript class that includes a getter and setter method: export class KitSection { uid: string; order: number; set layout(layout: KitLayout) { this._layout = new KitLayout(layout); } get layout( ...

Choose a file in React by specifying its path instead of manually picking a file

Is there a way for me to automatically select a file from a specified path into my state variable without having to open a select file dialog? I'm looking for a solution where I can bypass the manual selection process. Any suggestions on how this can ...

The aesthetic of the material tree design is not being reflected as expected

I am attempting to recreate the material tree example showcased here. This is the desired outcome: https://i.sstatic.net/dnkm2.png However, my result appears like this: https://i.sstatic.net/JXdbo.png Below is the HTML code I am utilizing: <mat-tr ...

``There is an issue with Cross-Origin Resource Sharing (CORS) in a Node.js application utilizing TypeScript

I've encountered some issues with my application, specifically regarding CORS. I suspect it may be due to a misconfiguration on my server. The problem arises when I attempt to create a user in my PostgreeSQL database via the frontend. I have a tsx com ...

Implementing Dynamic Component Rendering in React Native with Typescript

For the past 3 hours, I've been grappling with this particular issue: const steps = [ { Component: ChooseGameMode, props: { initialValue: gameMode, onComplete: handleChooseGameModeComplete } }, { Com ...

Retrieving Information from Multiple APIs Simultaneously

I'm currently integrating AngularJS into my project: var retrieveApi = function(){ $http.get(link) .then(function(response) {$scope.data = response.data.api}); } However, I am faced with a new challenge this time. I need to retrieve data ...

What is the best way to implement a toggle button in Angular that alternates between saving and unsaving content with two separate

I'm in the process of developing a toggle save/unsave feature similar to what is commonly seen on Reddit pages. Intended Functionality A list of objects (stories) are displayed, each with a link labeled "save" if not already saved, and "unsave" if a ...

Optimizing Test Data Management for Protractor in Angular E2E Testing: How to Choose the Most Effective Strategy

As a beginner in the world of Angular and Protractor, I have successfully created several protractor test cases for automating tasks such as registration, login, and other pages. However, I am facing an issue when it comes to passing data into my test case ...

Issue detected in TypeScript code - "Could not locate property 'setSelectedFile' in type 'void'.ts(2339)"

Encountering a TypeScript error in my code and seeking assistance. Below are the codes of 2 files with the error message included for review. The file causing the error is named "NewPostForm.tsx". import React, { useState } from 'react&apos ...

How can I ensure my function waits for a promise to be resolved using Async / Await?

I'm running into an issue where I want my function to keep executing until the nextPageToken is null. The problem occurs when the function runs for the first time, it waits for the promise to resolve. However, if there is a nextPageToken present in th ...

Describing a function in Typescript that takes an array of functions as input, and outputs an array containing the return types of each function

Can the code snippet below be accurately typed? function determineElementTypes(...array: Array<(() => string) | (() => number) | (() => {prop: string}) | (() => number[])>) { /// .. do something /// .. and then return an array ...

Is there a way to obtain the Vimeo Video Id in JSON format similar to the YouTube API?

Utilizing the YouTube API, I am able to retrieve channel data effortlessly. However, when it comes to Vimeo Video, are there any similar methods available? I require a solution resembling this format: https://www.example.com/vimeo-api/search?part=snippet ...

Creating a hyperlink to a subdomain in TypeScript Execution File

I am seeking to add a link directing to a subdomain in the navigation bar of a react theme. Although I feel a bit hesitant about asking for help on something seemingly simple, I have struggled to find any relevant examples online to assist me. Below is the ...

The specified type 'x' cannot be assigned to the type 'x'. Error code: 2322

I encountered an issue with the code in @/components/ui/billboard.tsx file import { Billboard } from "@/types" interface BillboardProps { data: Billboard; }; const BillboardComponent: React.FC<BillboardProps> = ({ data }) => ...

Is it advisable to move operations outside of the useEffect hook?

Is it advisable to move code outside of the useEffect function in React? function BuyTicket(props: any) { useEffect(() => { //.. }, [eventId, props.history]); // IS IT RECOMMENDED TO PUT CODE HERE? const userNameL ...

Detecting incorrect serialized data entries based on data types

In the scenario where the type MyRequest specifies the requirement of the ID attribute, the function process is still capable of defining a variable of type MyRequest even in the absence of the ID attribute: export type MyRequest = { ID: string, ...

Leveraging jQuery plugins within an AngularJs application

I am currently trying to implement the tinyColorPicker plugin from here in my Angular app, but I am facing difficulties with it. An error message keeps appearing: TypeError: element.colorPicker is not a function In my index.html file, I have included th ...

Troubleshooting Guide: Resolving the "No parameterless constructor defined for this object" error in your AngularJS/MVC application

I have a complex CRM page where users can schedule classes that they attend and learn from. The process involves filling out fields in a Modal and clicking Save, which then gathers the data and passes it to C#. However, in this particular instance, I&apos ...

Wondering how to implement HubSpot Conversations SDK in a Typescript/Angular application?

Recently, I came across some useful javascript code on this website window.HubSpotConversations.widget.load(); window.HubSpotConversations.widget.refresh(); window.HubSpotConversations.widget.open(); window.HubSpotConversations.widget.close(); Now, I am l ...