When clicking add it should keep inserting object to the array and the order Id should be based from the current order id + 1 of the objects on the array so for example if if templatesDto is empty then every order in the object should increment starting from 0 when I click add but for example there are existi…
Tag: javascript
How to change the locale in Flowbite datepicker?
Unfortunately the Flowbite Datepicker Documentation has no instruction on how to use another locale, but the support is there. This is how I implemented the datepicker (working): and this is how I try to get the locale to work: But my modular Javascript understanding is too poor to get this right. This is the…
What happened inside if assign a primitive type value to a function’s prototype?
It prints false. What happened inside if I insist to assign a depreciated type to function’s prototype property? Answer When calling a function with new, as part of the call an object is created and its prototype will be automatically set. Normally, this would be the prototype property of the constructo…
Understanding difference between calling function with double parentheses and two finctions
I was trying to understand how debounce work. In one of the tutorials in the internet I found codel ike this: And here comes my question. Why do I need to create explicit variable for calling this function? Can’t I simply call debounce in Event Listener? I tried doing something like this: However it wou…
Why is my get request from a JSON online file won’t refresh at new render?
I’m doing the folloing request over a json file stored on an azure blob. I nested this function in a useEffect hook It’s working well as I can get the data and display it. My issue is that it’s never refreshing at page/component render. The only solution is to clear cache. How can I force th…
Display file to user after conversion
I would like to write a service for converting files from one format to another (something similar at https://convertio.co/mp4-gif/) . I already have a file upload button that allows the user to upload a file from their device to the site. There is a box that displays the file name, size, desired format for c…
Angular 12 – *ngIf;Then;Else – must be a TemplateRef, but received ‘[object HTMLInputElement]’
After migrating Angular 6.x to Angular 12.x, I’m facing template related issues. UPDATED I’ve my code like this Below error i got ERROR Error: ngIfElse must be a TemplateRef, but received ‘[object HTMLInputElement]’ What i tried? ts Could someone help me how to can refactor pieces ? Th…
How to iterate through a JavaScript object and get parent properties?
I’m iterating through a JS object (obj) and would like to retrieve the parent property of a property. E.g. if k is ‘v9’. Something like k.parent would return ‘c’ and k.parent.parent would return ‘b’. Of course, the syntax is different and that’s what I’m l…
Chart.js timeline [Group for single bar]
I would like to create a time line like this: [1]: https://i.stack.imgur.com/RQ819.png But I don’t understand how to put green into the top bar and yellow into the bottom bar. This is what I got so far but I don’t find anything how to make group only for one bar. Answer You need to define a separa…
If I don’t choose a file and press the send button, I will get a popup but it’ll break any future popups
If I press Send ☞ without choosing a file, it’ll say “No file selected.” in a little Bootstrap warning alert but it seems to break all future alerts like file uploaded or file already exists on disk. If I make an error alert like file already on disk, it’ll work and won’t break f…