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 […]
Catégorie: Type Script
(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, […]
TypeScript – Variable : what is the difference between (var, let, const ) ?
TypeScript follows the same rules as JavaScript for variable declarations. Variables can be declared using: var let const The let declarations follow the same syntax as var declarations. but you have to know that, variables declared with let have a block-scope. Block-scope means that the scope of let variables is limited to their containing block, […]
How to integrate Angular 8 with Camunda BPM ? (SOLVED – Git Repo)
To integrate Camunda with Angular Single Page (Version 6 / 8 / 9)Try this Git repository : Camunda + Angular https://github.com/marwenmselmi/camunda-angular-6-8-9
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 […]
How to check if value exists in enum in TypeScript
Solution : If you get an error for: Property ‘values’ does not exist on type ‘ObjectConstructor’, then you are not targeting ES2017. You can either use this tsconfig.json config: Or you can just do an any cast:
Solution for : An unhandled exception occurred: Job name “..getProjectMetadata” does not exist
Problem : When I start to run my Application, I get this error: I have these versions: Angular CLI: 8.3.19, Node: 12.14.0. Any Idea what causes this problem ? Solution It is a problem with @angular-devkit/build-angular. Try updating it by running : 2. Or downgrading it by specifying a previous version, such as
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 […]

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 […]

TypeScript Solution : how to clone an object ?
If we need to clone an object we can use the Object.assign method. We can use this method to copy the values of all enumerable own properties from one or more source objects to a target object. It will return the target object.

TypeScript: remove duplicated values from an array
If we have an array (even not ordered) and we want to remove duplicated values, we can use the filter method:

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 […]