Posts

How to export data to excel sheet with colors and style in angular.

 There are two most popular library for javascript to export data with excel sheet. 1) xlsx library 2) exceljs library If you would like to export simple data without changing its style then xlsx is perfact, but if you would like to change style before export then exceljs is perfect for JavaScript frameworks. Lets create an example with exceljs library to export data by changing style and colors for angular. Step 1: Install "exceljs" library                npm install exceljs Step 2: Install "file-saver" library to save excel file.                npm install file-saver Step 3: Import "exceljs" and "file-saver" library to your component. import * as ExcelJS from 'exceljs/dist/exceljs.min.js' ; import { saveAs } from 'file-saver' ; Step 4: Now create function in your component to export Data.   exportExcel ()   {     const workbook = new ExcelJS . Workbook ();   const worksheet = workbook . addWorksheet ( 'My

How to create array of class type

    public variableName: ClassName[] = [];

How to install Redis as a window service

Step1: First of all Install Redis in your system. Step2: run Bellow command by going to Redis folder redis-server -- service-install   Step3: Now restart your system and Check Redis is working now.

How to change file with cmd on linux

step 1: Go to the directory where file exists then use bellow command to open file sudo vi filename step 2: Press i  to go to edit mode. now update your file step 3: Now press Esc then type  :wq!   to save and exit.

How to access shared folder from other PC on same network

 Go to run (win +r) type in \\ along with IP address of the sharing PC in this case e.g \\192.168.2.4 and press enter. You will get the folder that were shared

how to call angular function inside document.ready or setTimeout

use arrow function like bellow example myFunction() {      console.log('function called'); } Use like bellow $ ( document ). ready (() => { this . myFunction (); });

How to add common api url link to environment page in angular

step1) add url to your environment.ts.   export const environment = { production: false , apiUrl: 'www.localurl.com' }; step2) add same url to your environment.prod.ts export const environment = { production: true , apiUrl: 'www.productionurl.com' }; Now when you build for production like ng build --env=prod it will automatically use production url and when you build for local use like ng build it will use local url.