symfony - Installing Javascript in symfony2 -
hi stackoverflow people.
im trying use javascript graph in test twig view. view:
<h1>test</h1> {% javascripts '@acmefoobundle/resources/public/js/*' %} <script src="{{ asset_url }}" type="text/javascript"> window.onload = function () { var chart = new canvasjs.chart("chartcontainer", { title:{ text: "fruits" }, data: [//array of dataseries { //dataseries object /*** change type "column" "bar", "area", "line" or "pie"***/ type: "column", datapoints: [ { label: "banana", y: 18 }, { label: "orange", y: 29 }, { label: "apple", y: 40 }, { label: "mango", y: 34 }, { label: "grape", y: 24 } ] } ] }); chart.render(); } </script> <script type="text/javascript" src="{{ asset_url }}"></script> {% endjavascripts %} <body> <div id="chartcontainer" style="height: 300px; width: 100%;"> </div> </body>
so problem javascript library not installed because returns me error message:
an exception has been thrown during compilation of template ("you must add preditbundle assetic.bundle config use {% javascripts %} tag in preditbundle:default:test.html.twig.") in "preditbundle:default:test.html.twig".
things i've tryed:
-follow step step page "how use assetic asset management -use console comands : assets:install , assetic:dump
thanks answers
you have add bundle in config.yml.
assetic: bundle: [ preditbundle ]
Comments
Post a Comment