• Register
1 vote

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

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) {  
    // To allow same origin resource loads.
    // To allow loading from our assets domain. **.

Hope above solution helped you in fixing your issue.

8 4
5,680 points

Related questions

0 votes
1 answer 14 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 Raphael Pacheco 4.9k points
1 vote
1 answer 17 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 Martin K 6.6k points
0 votes
1 answer 987 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