Forum Discussion
Integrate Power Bi DASHBOARD with AngularJS not REPORT
Thanks for reply
the script that u have mentioned
<script src="https://microsoft.github.io/PowerBI-JavaScript/demo/bower_components/jquery/dist/jquery.js"></script> <script src="https://microsoft.github.io/PowerBI-JavaScript/demo/bower_components/powerbi-client/dist/powerbi.js"></script>
is returning 404. we have changed the access token and embed the url but unble to see any output.
Please suggest .
Anonymous
Download the powerbi.js and put it in the same folder of the html page and change the lines to
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script> <script src="powerbi.js"></script>
- Anonymous9 years agoNot applicable
Thanks for reply.
This is what we are trying get 401 response
<html>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
<script src="powerbi.js"></script>
<script type="text/javascript">
window.onload = function () {
var embedConfiguration = {
type: 'dashboard', // change report to dashboard
accessToken: '__________________',
//change report embed url to dashboard embed url
embedUrl: 'https://app.powerbi.com/dashboardEmbed?dashboardId=a3ee4a0b-7b09-42dc-977a-27f749377088'
};
var $reportContainer = $('#dashboardContainer');
var report = powerbi.embed($reportContainer.get(0), embedConfiguration);
}
function reloadreport(){
var element = $('#dashboardContainer');
alert(element);
var report = powerbi.get(element);
report.reload().catch(error => {console.log(error) });
};
</script>
<div id="dashboardContainer"></div>
</html>Please suggest were we are going wrong.
- Eric_Zhang9 years agoMicrosoft Employee
Anonymous
401 indicates a unauthorized error, is the token in your case valid? Below sample actually works. For testing purpose, you can get a valid token in a quick way. Just replace the token and dashboardid in your case.
<html> <script src="https://microsoft.github.io/PowerBI-JavaScript/demo/node_modules/jquery/dist/jquery.js"></script> <script src="https://microsoft.github.io/PowerBI-JavaScript/demo/node_modules/powerbi-client/dist/powerbi.js"></script> <script type="text/javascript"> window.onload = function () { var embedConfiguration = { type: 'dashboard', // change report to dashboard accessToken: 'yourTokenHere', //change report embed url to dashboard embed url embedUrl: 'https://app.powerbi.com/dashboardEmbed?dashboardId=yourdashboardid' }; var $reportContainer = $('#dashboardContainer'); var report = powerbi.embed($reportContainer.get(0), embedConfiguration); } </script> <div id="dashboardContainer"></div> </html>