簡體   English   中英

angular2 systemJs相對路徑問題

[英]angular2 systemJs relative path issue

在Angular 2中使用ng2-bootstrap時出現問題。SystemJS無法將時間解析為node_modules目錄,而是抱怨相對路徑。

這是使用導入從由路由構造的組件中引用的

import { TOOLTIP_DIRECTIVES } from 'ng2-bootstrap';

有人可以幫忙嗎?

提前致謝。

<script src="~/node_modules/systemjs/dist/system.src.js"></script>
<script src="~/node_modules/es6-shim/es6-shim.min.js"></script>
<script src="~/node_modules/angular2/bundles/angular2-polyfills.js"></script>
<script src="~/node_modules/moment/min/moment.min.js"></script>
<script src="~/node_modules/ng2-bootstrap/ng2-bootstrap.js"></script>
<script>
    System.config({
        defaultJSExtensions: true,
        baseURL: '/ECAV.Admin/node_modules',
        packages: {
            'app': { format: 'register', defaultExtension: 'js' },
            'rxjs': { defaultExtension: 'js' }
        },
        paths: {
            'angular2/*': 'angular2/*',
            'rxjs': 'rxjs/bundles/Rx.js',
            'linqsharp': 'linqsharp/built/linqsharp',
            'highcharts': 'highcharts',
            'ng2-highcharts': 'ng2-highcharts/ng2-highcharts',
            'lodash': 'lodash/lodash',
            'ng2-bootstrap':'ng2-bootstrap/ng2-bootstrap'
        },
        map: {
            moment: 'moment/moment.js'
        }
    });
</script>
<script src="~/node_modules/rxjs/bundles/Rx.js"></script>
<script src="~/node_modules/angular2/bundles/angular2.dev.js"></script>
<script src="~/node_modules/lodash/lodash.js"></script>

關於時刻庫的配置,您可以嘗試以下方法:

System.config({
  (...)
  map: {
    'moment': 'moment/moment'
  },
  (...)
});

看到這個問題:

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM