$ is not defined while implementing angular data-tables in ionic


#1

Hi,

I am new to ionic. I am creating one simple application in ionic 3 angular 4. In this while implementing the angular datatable. I got the following error.

vendor.js:1822 ERROR ReferenceError: $ is not defined.

I don’t know what I am doing wrong. Please help me to resolve this issue.

angular-cli.json:

{
“$schema”: “./node_modules/@angular/cli/lib/config/schema.json”,
“project”: {
“name”: “sample-datatables”
},
“apps”: [
{
“root”: “src”,
“outDir”: “dist”,
“assets”: [
“assets”,
“favicon.ico”
],
“index”: “index.html”,
“main”: “main.ts”,
“polyfills”: “polyfills.ts”,
“test”: “test.ts”,
“tsconfig”: “tsconfig.app.json”,
“testTsconfig”: “tsconfig.spec.json”,
“prefix”: “app”,
“styles”: [
“styles.css”,
“…/node_modules/bootstrap/dist/css/bootstrap.css”,
“…/node_modules/datatables.net-bs4/css/dataTables.bootstrap4.css”,
“…/node_modules/datatables.net-dt/css/jquery.dataTables.css”
],
“scripts”: [
“…/node_modules/jquery/dist/jquery.js”,
“…/node_modules/datatables.net/js/jquery.dataTables.js”,
“…/node_modules/datatables.net-bs4/js/dataTables.bootstrap4.js”,
“…/node_modules/popper.js/dist/umd/popper.js”,
“…/node_modules/bootstrap/dist/js/bootstrap.js”
],
“environmentSource”: “environments/environment.ts”,
“environments”: {
“dev”: “environments/environment.ts”,
“prod”: “environments/environment.prod.ts”
}
}
],
“e2e”: {
“protractor”: {
“config”: “./protractor.conf.js”
}
},
“lint”: [
{
“project”: “src/tsconfig.app.json”,
“exclude”: “/node_modules/
},
{
“project”: “src/tsconfig.spec.json”,
“exclude”: “/node_modules/
},
{
“project”: “e2e/tsconfig.e2e.json”,
“exclude”: “/node_modules/
}
],
“test”: {
“karma”: {
“config”: “./karma.conf.js”
}
},
“defaults”: {
“styleExt”: “css”,
“component”: {}
}
}

todoList.html:

To-do List
ID First name Last name
1 Foo Bar
2 Someone Youknow
3 Iamout Ofinspiration
4 Yoda Skywalker
5 Patrick Dupont
6 Barack Obama
7 François Holland
8 Michel Popo
9 Chuck Norris
10 Simon Robin
11 Louis Lin
12 Zelda Link

In app.module.ts i have imported the following,

import { DataTablesModule } from ‘angular-datatables’;

@NgModule({
.
.
.
imports: [
DataTablesModule
]
})

Thanks in advance