0

I have created a Angular 4 with dot net core application using visual studio template. I want to use datatables in my app and tried to follow steps using https://l-lin.github.io/angular-datatables/#/getting-started But I received error as : ReferenceError: $ is not defined. I tried to use import * as $ from "jquery"; But did not work. Please advice. Thank you.

1
  • Please provide some more information, clarify your question, and format it correctly (put code in a code block). Otherwise, it will be very difficult to answer your question helpfully. See: stackoverflow.com/help/how-to-ask Commented Mar 27, 2018 at 22:21

1 Answer 1

1

You can't follow https://l-lin.github.io/angular-datatables/#/getting-started for a .Net Core - Angular Application. The setup requires .angular_cli.json and since you're not using ng serve, it will not work that way.

Possibly you can add CDN .js packages on your ASP .NET index.cshtml file:

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" type="text/javascript"></script>
<script src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js" type="text/javascript"></script>

And add css on your _Layout.cshtml file:

<link rel="stylesheet" href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css" />

Please check and let us know if that works. Good Luck.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.