Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

Metronic 8 for Angular


Dear Support Teams,

I have a questions using metronic in my angular application.

1. Does jquery already installed in metronic or should i import jquery library using npm.

2. I want to use metronic 8 datatables for my angular application. Do you have any guidelines in order to do that.

Thank you


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (3)


Hi Cheyo,

By default, jQuery is not included in Angular. You will need to install it separately if you want to use it in your project.

To use DataTables in an Angular application with Metronic, you can follow these steps:

Install the required packages: You can install the required packages using npm. Run the following command in your terminal:


npm install jquery datatables.net datatables.net-bs4


This command will install jQuery, DataTables, and Bootstrap 4 styling for DataTables.

Import the required styles and scripts: In your angular.json file, add the following styles and scripts:


"styles": [
"node_modules/datatables.net-bs4/css/dataTables.bootstrap4.min.css"
],
"scripts": [
"node_modules/jquery/dist/jquery.min.js",
"node_modules/datatables.net/js/jquery.dataTables.min.js",
"node_modules/datatables.net-bs4/js/dataTables.bootstrap4.min.js"
]


This will import the required styles and scripts for DataTables.

Initialize DataTables: In your component where you want to use DataTables, you can initialize it in the ngAfterViewInit lifecycle hook. Here's an example:



import { Component, OnInit, AfterViewInit } from "@angular/core";
import * as $ from "jquery";
import "datatables.net";
import "datatables.net-bs4";

@Component({
selector: "app-my-datatable",
templateUrl: "./my-datatable.component.html",
styleUrls: ["./my-datatable.component.css"]
})
export class MyDatatableComponent implements OnInit, AfterViewInit {

constructor() { }

ngOnInit() {
}

ngAfterViewInit() {
$(document).ready(function() {
$("#myTable").DataTable();
});
}
}


This will initialize the DataTables plugin on an HTML table with the ID myTable.

Thanks



terima kasih faizal,

How about calendar, can i use Tempus Dominus calendar in metronic angular. or do i need to install ngx-tempusdominus-bootstrap in order to use calendar.

Thanks



Hi Cheyo,

Yes, you can use ngx-tempusdominus-bootstrap in your Metronic Angular project to use the Tempus Dominus datetime picker.

You can install ngx-tempusdominus-bootstrap using npm by running the following command:


npm install ngx-tempusdominus-bootstrap --save


You can check their documentation for further examples:
https://fetrarij.github.io/ngx-tempusdominus-bootstrap

Thanks


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(