I'm currently facing an issue with my app where I am trying to enable users to input Youtube URLs for videos to be displayed on the site. However, before implementing this feature, I need to whitelist Youtube. How can I adjust my typescript file (app.ts) to accommodate this? The documentation suggests the following configuration:
.config(function ($sceDelegateProvider) {
$sceDelegateProvider.resourceUrlWhitelist([
'self', // trust all resources from the same origin
'*://www.youtube.com/**' // trust all resources from `www.youtube.com`
]);
});
The problem I am encountering is that my .config does not include the function keyword, which I suspect is due to using typescript. Currently, my config code looks like this:
angular.module('MyApp', ['ngRoute', 'ngResource']).config(($routeProvider: ng.route.IRouteProvider, $locationProvider: ng.ILocationProvider, $sceDelegateProvider: ng.ISCEDelegateProvider ) => {
$sceDelegateProvider.resourceUrlWhitelist([
'self',
'*://www.youtube.com/**'
]);
Despite making these adjustments, I am still receiving an error indicating that the URL is not being whitelisted. Should I move the .config block containing the function or is there a way to integrate the Delegate provider within the existing setup alongside route and location providers?