• Register
1 vote
418 views

Problem :

I am beginner to Angular Js. I am trying to learn the AngularJS. Below is my code from my controllers.js file.

'use strict';

angular.module ( 'F1FeederApp.controllers' , [ ]                                     )
.controller    ( 'driversController'       , function ( $myscope , myergastAPIservice ) {

    $myscope.nameFilter = null;
    $myscope.driversList = [];

    myergastAPIservice.getDrivers ().success ( function ( response ) {
        $myscope.driversList = response.MRData.StandingsTable.StandingsLists [ 0 ].DriverStandings;
    });
});

And I am facing below error:

“Blocked loading resource from url not allowed by $sceDelegate policy”

I am unable to figure out the cause of this error. Can someone guide me in fixing it?

8 5 2
3,230 points

Please log in or register to answer this question.

1 Answer

1 vote

Solution :

I have enough experience in Angular Js to be able to guide you in fixing your issue. I think your url which you are trying to use to send the request from the app is unsafe according to a AngularJS sceDelegatePolicy. So to fix your issue you must first whitelist your url in the app with the use of resourceUrlWhitelist method which is present in the $sceDelegateProvider as shown below for your reference :

angular.module('myApp', []).config(function($sceDelegateProvider) {  
$sceDelegateProvider.resourceUrlWhitelist([
    // To allow same origin resource loads.
    'self',
    // To allow loading from our assets domain. **.
    'http://ergast.com/**'
  ]);

Hope above solution helped you in fixing your issue.

8 4 1
5,680 points

Related questions

0 votes
1 answer 8 views
8 views
Problem: blocked loading resource from url not allowed by $scedelegate policy. I’m new Can someone help me??
asked Mar 6 Umar Ahmad 4.1k points
0 votes
1 answer 3 views
3 views
Problem: I add an API with script. When I load the page, I get following error: XMLHttpRequest cannot load apiendpoint URL. Redirect from 'apiendpoint URL' to 'apiendpoint URL' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'test URL' is therefore not allowed access.
asked May 4 Supti 13k points
0 votes
1 answer 23 views
23 views
Problem: I am working on an app using Vue js. According to my setting I need to pass to a variable to my URL when setting change. <!-- language: lang-js --> $.get('http://172.16.1.157:8002/firstcolumn/' + c1v + '/' + c1b, function (data ... by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access.
asked May 1 anika11 32.2k points
0 votes
1 answer 78 views
78 views
Problem: How I can fix this issue: error trying to diff '[object object]'. only arrays and iterables are allowed
asked Mar 14 Wafa Abu Yousef 6.1k points
0 votes
1 answer 7 views
7 views
Problem: Could someone please assist me? > Access to xmlhttprequest has been blocked by cors policy .
asked 3 days ago Isac Christiaan 9.6k points
0 votes
1 answer 7 views
7 views
Problem: I am working on an app using Vue js. According to my setting I need to pass to a variable to my URL when setting change. <!-- language: lang-js --> $.get('http://172.16.1.157:8002/firstcolumn/' + c1v + '/' + c1b, function (data ... by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access.
asked May 2 ochena 23.3k points
0 votes
1 answer 25 views
25 views
Problem: I am facing the following error : Pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug .
asked Mar 14 Wafa Abu Yousef 6.1k points
0 votes
2 answers 2.1K views
2.1K views
Problem : I am facing the following error : malloc: *** error for object 0xa68aca0: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug I have already set the Symbolic Breakpoint, Still Nothing happens on the console, Not getting any hint from the console. I am having xcode 4.6 Does anybody have any clue about the error?
asked Nov 28, 2019 alecxe 7.5k points
0 votes
1 answer 5 views
5 views
Problem: the method specified in the request is not allowed for the resource identified by the request URl
asked Feb 23 Muneeb Saadii 130k points