I'm attempting to replace <link href='http://fonts.googleapis.com/
... with <link href='http://fonts.useso.com/
... for my users in China for an Angular (currently) 6 application. There is an excellent article describing how to do so in JavaScript, but I don't know enough to come up with the equivalent in Angular. I considered ViewChild
but it seems that only gives you child components of a component. Here's the function in JavaScript:
function replaceGoogleCDN() {
$('link').each(function(){
var $intial = $(this).attr('href'),
$replace = $intial.replace('//fonts.googleapis.com/', '//fonts.useso.com/');
$(this).attr('href', $replace);
});
}
and here are a few lines from the index.html
with the two links that I need to change:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<base href="/">
...
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700,400italic" rel="stylesheet">
</head>
<body>
<app-root>
...
How do I do this in Angular?