• Register
1 vote
299 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
5,680 points

Related questions

0 votes
2 answers 1.8K views
1.8K 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 92 views
92 views
Problem : I am getting following error cross-origin request blocked: the same origin policy disallows reading the remote resource at
asked Nov 15, 2019 peterlaw 6.9k points
0 votes
1 answer 22 views
22 views
Problem: I am a complete beginner to typescript and I written have two classes. In my parent class I have written below code: abstract class Component {  public deps: any = {};  public props: any = {}; public setProp(prop: string): any {     return <T>( ... invoke an expression whose type lacks a call signature." I am looking for the typescript expert who can suggest quick fix for my above error.
asked Aug 11, 2020 Raphael Pacheco 4.9k points
1 vote
1 answer 27 views
27 views
Problem: I have recently started learning the AngularJS. I have gained the fundamental knowledge in AngularJs with the help of online tutorials so I was just experimenting I started facing below error: Uncaught Error: [$injector:modulerr] Failed to instantiate module. Please find below my ... </div>         </div>     </body> </html> Kindly help me in fixing my above error related to AngularJs.
asked Jun 12, 2020 Martin K 6.6k points
0 votes
1 answer 1.4K views
1.4K views
Problem : I am facing following Jasmine issue and looking for solution: async callback was not invoked within timeout specified by jasmine.default_timeout_interval.
asked Nov 16, 2019 peterlaw 6.9k points
0 votes
1 answer 261 views
261 views
Problem : When I try to upload my application on to the GoDaddy shared Plesk hosting account, I get the below error. &ldquo;This program is blocked by group policy. For more information, contact your system administrator.&rdquo; Does anyone know a purpose of this block or why the Microsoft puts it there? Please Note : The app uses C# and not VB.
asked Feb 4, 2020 jwilliam 3.9k points
0 votes
1 answer 1.6K views
1.6K views
Problem : I am facing the below error: Failed to load resource: the server responded with a status of 401 (Unauthorized) http://localhost/App/AngularJS/angular.min.js My project works fine on the localhost. But when I try to run it on the IIS (7.5) I often face ... read/write/modify access for the "IUSR" & "IIS_ISURS" users of my whole project. But still I am facing the same exception on my IIS.
asked Dec 24, 2019 alecxe 7.5k points