(Solution) : Angular 2+ DataTable / DIV to PDF File

if you want to generate a pdf file from datatable / Array or content in HTML Div : run this : 2. import : 3. create the datatable or the content to print in html div: 4. Create a button to generate PDF and put the as click action “generatePdf(contentToConvert)” 5. Finaly past this function […]

En Lire Plus

(Solution) TypeScript : convert an Object to Map values ?

Problem : I need to convert an object to a map to get the values of key dynamically Solution : The Map constructor takes an array of key-value pairs. Object.entries is a new Object static method available in ES2017 (19.1.2.5) If you need to support older environments and transpilation is not an option for you, […]

En Lire Plus

Solution for : “execution of scripts is disabled on this system.”

Solution : execution of scripts is disabled on this system Go to Start Menu and search for “Windows PowerShell ISE”. Right click the x86 version and choose “Run as administrator”. In the top part, paste Set-ExecutionPolicy RemoteSigned; run the script. Choose “Yes”. Repeat these steps for the 64-bit version of Powershell ISE too (the non […]

En Lire Plus

Solution for : net::ERR_CONNECTION_REFUSED in Angular

net::ERR_CONNECTION_REFUSED : I’d like to access an API server, but the server hasn’t started. Then I got the error : Could I handle this according to the status of the response ? Solution 1 : Solution 2 : If you are using spring for the backend , just add the annotation @crossorigin in your rest controller to […]

En Lire Plus

TypeScript : how to sleep a thread ?

If we need to sleep e thread, we can implements a delay method that returns a Promise object (which represents the eventual completion, or failure, of an asynchronous operation, and its resulting value) and through the setTimeout method (that sets a timer which executes a function or specified piece of code once after the timer expires) resolve […]

En Lire Plus

TypeScript: map an objects collection into a different one

The map() method is helpful to creates a new array with the results of calling a provided function on every element in the calling array. Suppose that we have two classes: And we have an Angular service called ‘myService‘ that through a .getObjects() method returns the following data: If we need to fill a DestinationType array […]

En Lire Plus