Hi Everyone,
I am trying to use an AMD package from boost theme (/theme/boost/amd/build/collapse.min.js) in my own theme. My questions are: What is the proper way to load an AMD module inside another AMD module? And, once it is loaded, how can I use it?
What I did so far:
define(['jquery', 'theme_boost/collapse'], function($, collapse) {
return {
init: function() {
$("#element").collapse('show');
}
};
});
This gives me the error: error 'collapse' is defined but never used no-unused-vars
require.config({
paths: {
"collapse": "theme_boost/collapse"
}
});
define(['jquery'], function($) {
return {
init: function() {
$("#element").collapse('show');
}
};
});
This gives me the error: TypeError: a(...).collapse is not a function
I am using Moodle 3.7.1 on LAMP
Thank you in advance for your help