【发布时间】:2016-05-12 23:10:38
【问题描述】:
我正在使用 Angular 2 创建一个应用程序。我想在我的应用程序中使用 Angular 材质。但是角度材料尚不适用于角度 2 我尝试在我的应用程序中使用 ng2-material 我使用 npm install 安装它并在应用程序组件中添加材料指令并将其映射到 index.php 中,如下所示但是当我尝试运行应用程序时它给出了错误。
index.php
<!doctype html>
<html>
<head>
<base href="/">
<title>Angular 2 QuickStart</title>
<!-- 1. Load libraries -->
<script src="node_modules/angular2/bundles/angular2-polyfills.js"></script>
<script src="node_modules/systemjs/dist/system.src.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/angular2/bundles/router.dev.js"></script>
<script src="node_modules/angular2/bundles/http.dev.js"></script>
<link rel="stylesheet" href="node_modules/ng2-material/dist/ng2-material.css">
<link rel="stylesheet" href="node_modules/ng2-material/dist/font.css">
<!-- 2. Configure SystemJS -->
<script>
System.config({
packages: {
app: {
format: 'register',
defaultExtension: 'js'
},
'ng2-material': {
format: 'register',
defaultExtension: 'js'
}
},
map: {
'ng2-material': 'node_modules/ng2-material'
}
});
System.import('app/boot')
.then(null, console.error.bind(console));
</script>
</head>
<!-- 3. Display the application -->
<body>
<my-app>Loading...</my-app>
</body>
</html>
错误
Uncaught ReferenceError: require is not defined
谁能帮帮我。
【问题讨论】:
标签: angular