Skip to content

Author: admin@master

How to call a vue.js function on page load

I have a function that helps filter data. I am using v-on:change when a user changes the selection but I also need the function to be called even before the user selects the data. I have done the same with AngularJS previously using ng-init but I understand that there is no such a directive in vue.js This is …

What is the purpose of the script scope?

When inspecting scopes of a function in the DevTools console I noticed a “script” scope. After a bit of research it seems to be created for let and const variables. Scopes of a function in a script without const or let variables: Scopes of a function in a script with a let variable: Yet the follow…

Using Charts.js with react

I am using React and want to tie it in with Chart.js. The graph below works, but I am not sure how to make a Graph component in React. My Chart.js code looks like the following: I then tried to incorporate this into React. Unfortunately, this didn’t work. My code attempt can be seen here.This is kind of…

How to pass a value from javascript to drupal 8 form?

I need to pass a value from Javascript to my drupal 8 form. I’ve added a hidden field to the form. Javascript is calculating a value and writes it into the field. But how can I get to the value within the function submitForm()? Is using a hidden field even the right approach? If so, what do I have to

Find missing day from array of dates javascript

I am getting an array of day dates from an API: In this example the array is missing this date: What is the best way to find a missing day from an array of dates in Javascript or Angular? So that I later would be able to pass it to a datepicker as a disabled day. Answer Check this out:

ES6 deep nested object destructuring

I have an object called this.props which contains statement contains I would like to extract statement object and the isConfirmed property in the same line using es6 destructuring I’ve tried which I get an error when I do let a = isConfirmed, b = statement Answer I would like to extract statement object…