0
我想要获得SVG渐变效果,并且从我在网上看到的技巧是使用APP_BASE_HREF
而不是定义<base href="/">
。这确实可以解决问题,但它也会创建一个新的问题。如果我深入一层/home/test
bundle.js脚本无法加载。APP_BASE_HREF导致* .bundle.js脚本无法加载
错误
GET http://localhost:4200/home/inline.bundle.js
goals:47 GET http://localhost:4200/home/polyfills.bundle.js
goals:47 GET http://localhost:4200/home/styles.bundle.js
goals:47 GET http://localhost:4200/home/vendor.bundle.js
goals:47 GET http://localhost:4200/home/main.bundle.js
goals:47 GET http://localhost:4200/home/inline.bundle.js
goals:47 GET http://localhost:4200/home/polyfills.bundle.js
goals:47 GET http://localhost:4200/home/styles.bundle.js
goals:47 GET http://localhost:4200/home/vendor.bundle.js
goals:47 GET http://localhost:4200/home/main.bundle.js
它寻找http://localhost:4200/main.bundle.js
但现在,基础裁判是不正确的是它改变/home/main.bundle.js
什么是此设置的正确方法是什么?
- 我不想使用
APP_BASE_HREF
休息 进口如上使用HTML5#位置 - 但修复我的SVGs
<base href="/">
这个工程 除了我的SVG梯度,其中url(#gradient)
现在引用错了地方并找不到我的defs。
这是我的设置:
app.module.ts
import { CommonModule, APP_BASE_HREF } from '@angular/common';
并提供了:
providers: [
{provide: APP_BASE_HREF, useValue: "/"},
],