【发布时间】:2016-12-30 10:47:58
【问题描述】:
我正在尝试安装时刻。
在npm install moment --save之后,我在我的组件中导入了moment,但是当我重新加载页面时,我得到了404错误:http://localhost:3000/moment
这是我的组件文件导入代码:
import {Input, Output, Component} from "angular2/core"
import {TicketService} from "../services/ticket.service"
import {Ticket} from "./ticket";
import {OnInit} from "angular2/core";
import {Router, RouteParams, RouterLink, ROUTER_DIRECTIVES} from "angular2/router";
import * as moment from 'moment';
我不明白为什么。有人可以帮我吗?
这是我的 System.config
<script>
System.config({
packages: {
app: {
format: 'register',
defaultExtension: 'js'
}
}
});
System.import('app/boot')
.then(null, console.error.bind(console));
</script>
【问题讨论】:
-
尝试安装angular2-moment包。
-
您是否定义了要在 node_modules 下映射的“地图”?
-
@echonax 不,我没有
-
你能分享你的 system.config.js 吗?
-
@echonax 嗨,我加了,谢谢~
标签: angular momentjs systemjs npm-install