I'm trying to use a progressbar plugin, I've installed it using npm install progressbar.js
& required it in my app.js
file.
I have also defined my custom function - generate_circle()
in my app.js
file.
When I call my custom function generate_circle()
in the view inside a script tag I get the error
Uncaught ReferenceError: generate_circle is not defined
in my console. The plugin files are loaded correctly because I can see the plugin code in the app.js
file.so that is not the issue.
Can anybody help me with this?
This is how my app.js file look like
require('./bootstrap');
var ProgressBar = require('progressbar.js');
function generate_circle(){
var circle = new ProgressBar.Circle('.box',{
color: '#FF0000',
strokeWidth: 5,
trailColor: '#f4f4f4',
fill: 'black',
duration: 5000,
warnings: true,
from: { color: '#38ef7d' },
to: { color: '#11998e' },
step: function(state, circle, attachment) {
circle.path.setAttribute('stroke', state.color);
},
});
alert(1);
circle.animate(1);
}
And this is my view :
--- header and other stuff ---
<script src=""></script>
<script>
generate_circle();
</script>
</body>
</html>
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire