Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 在应用程序组件中添加文档标记会导致前置错误_Angular - Fatal编程技术网

Angular 在应用程序组件中添加文档标记会导致前置错误

Angular 在应用程序组件中添加文档标记会导致前置错误,angular,Angular,我正在尝试在HTML文档中加载脚本。我得到的错误如下“prepend”函数。我在Angular应用程序组件的构造器文档中使用它 Failed to load resource: net::ERR_NAME_NOT_RESOLVED 我的添加标记代码是 const script = document.createElement('script'); script.async = true; script.type = 'text/javascript';

我正在尝试在HTML文档中加载脚本。我得到的错误如下“prepend”函数。我在Angular应用程序组件的构造器文档中使用它

Failed to load resource: net::ERR_NAME_NOT_RESOLVED
我的添加标记代码是

    const script = document.createElement('script');
    
    script.async = true;
    script.type = 'text/javascript';
    script.src = 'https://www.googletagmanager.com/gtag/js?id=' + const_key;
    document.head.prepend(script);
请帮忙