Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

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
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (3)


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:


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,

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


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(