3

これ ( https://github.com/gocardless/es6-angularjs/blob/master/README.md ) を出発点として使用してから、ブートストラップJavaScript コードを含めます。モーダルを開くには

しかし、起こる唯一のことは次のとおりです。

Potentially unhandled rejection [3] Error loading "components/bootstrap/dist/js" at http://localhost:3010/components/bootstrap/dist/js.js
Error loading "components/bootstrap/dist/js" from "app-compiled/bootstrap" at http://localhost:3010/app-compiled/bootstrap.js
Not Found: http://localhost:3010/components/bootstrap/dist/js.js (WARNING: non-Error used)

これをmain.jsに追加しました:

import 'bootstrap-js';
//TODO please explain to me why not working

これを loader.config.js ファイルに追加します。

System.config({
  meta: {

    ...,
    'components/bootstrap/dist/js':{ format: 'global', export: 'bootstrap'}


  },
  map: {

    ....,
    'bootstrap-js': 'components/bootstrap/dist/js'

  }
});
4

1 に答える 1

1
  1. exportsここの代わりに試してくださいexport
System.config({
    meta: {
    //...
        'components/bootstrap/dist/js':{ format: 'global', exports: 'bootstrap'}
    }
    //...
});
  1. 書き込み時に、グローバル変数{ format: 'global', exports: 'bootstrap'}を取得しようとしています。bootstrapしかし、そのようなものは存在しません。したがって、メタ行を削除してマップを修正する必要があると思います。結果は次のようになります。
System.config({
    meta: {
        //...
        'components/path/to/jquery': { format: 'global', exports: 'jQuery' },
        'components/bootstrap/dist/js/bootstrap': { deps: ['jquery'] }
    }
    map: {
        //...
        'jquery': 'components/path/to/jquery',
        'bootstrap-js': 'components/bootstrap/dist/js/bootstrap'
    }
});
于 2015-01-20T17:26:07.580 に答える