AngularJS errors: Blocked loading resource from url not allowed by $sceDelegate policy

Issue #1 :

The url you are trying to request from your app is not safe according to the AngularJS sceDelegatePolicy. To resolve it, you need to whitelist the url in your app using resourceUrlWhitelist method in $sceDelegateProvider as shown below :

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

For a clear explanation and above example are from here

Issue #2:

The issue with the error TypeError: ergastAPIservice.getDrivers(...).success is not a function could be due to the AngularJS version that you are using. The legacy .success/.error methods are now deprecated in the latest AngularJs version 1.6. Here is the Deprecation notice If you are using the latest AngularJs, that could be the reason, otherwise, we need more information to debug the issue.

Leave a Comment