使用<base href =“/”/>和SVG填充url()

时间:2016-08-16 15:28:11

标签: javascript svg angular

在Angular 2 RC4中,我如何以另一种方式正确定义基数,因为如果它被定义,我将无法使用fill: url("#grad1");

我可以破解我的网站运行此博客帖子: https://stacksandfoundations.com/2016/06/22/svgs-funciri-angular2-and-the-base-tag/

我在开头重写了依赖js路径,但如果用户想要打开一个不是索引的链接,我会收到此错误:http://localhost:3000/foods/app/components/app.component.html 404 (Not Found)

初始化了boot.js.

你有什么想法,我该怎么办呢?

我的系统js看起来像这样:

(function(global) {

  // map tells the System loader where to look for things
  var map = {
    '/app':                        '/app/', // 'dist',
    '@angular':                   '/node_modules/@angular',
    'angular2-in-memory-web-api': '/node_modules/angular2-in-memory-web-api',
    'rxjs':                       '/node_modules/rxjs',
    'linqts':                     '/node_modules/linqts'
  };
  // packages tells the System loader how to load when no filename and/or no extension
  var packages = {
    '/app':                        { main: '/boot.js',  defaultExtension: 'js' },
    'rxjs':                       { defaultExtension: 'js' },
    'angular2-in-memory-web-api': { main: '/index.js', defaultExtension: 'js' },
    'linqts':                     { main: '/linq.js' }
  };
  var ngPackageNames = [
    'common',
    'compiler',
    'core',
    'forms',
    'http',
    'platform-browser',
    'platform-browser-dynamic',
    'router',
    'router-deprecated',
    'upgrade',
  ];
  // Individual files (~300 requests):
  function packIndex(pkgName) {
    packages['@angular/'+pkgName] = { main: 'index.js', defaultExtension: 'js' };
  }
  // Bundled (~40 requests):
  function packUmd(pkgName) {
    packages['@angular/'+pkgName] = { main: '/bundles/' + pkgName + '.umd.js', defaultExtension: 'js' };
  }
  // Most environments should use UMD; some (Karma) need the individual index files
  var setPackageConfig = System.packageWithIndex ? packIndex : packUmd;
  // Add package entries for angular packages
  ngPackageNames.forEach(setPackageConfig);
  var config = {
    map: map,
    packages: packages
  };

  System.config(config);

})(this);

0 个答案:

没有答案