[英]Can I use Angular Material 2.0.0-alpha.9-3 with angular 2.1?
I try to user angular/material ^2.0.0-alpha.9-3 with Angular 2.1, but I get the exceptions: 我尝试使用Angular 2.1来使用angular / material ^ 2.0.0-alpha.9-3,但我得到了例外情况:
zone.js:1274 GET http://localhost:3000/@angular/material 404 (Not Found)
zone.js:1274 GET http:// localhost:3000 / @ angular / material 404(Not Found)
(index):16 Error: (SystemJS) XHR error (404 Not Found) loading http://localhost:3000/@angular/material (…)
(索引):16错误:(SystemJS)XHR错误(404 Not Found)加载http:// localhost:3000 / @ angular / material (...)
I have just created project using instruction on "Angular2 Quickstart" and run the command: "npm install --save @angular/material". 我刚刚使用“Angular2 Quickstart”上的指令创建了项目并运行命令:“npm install --save @ angular / material”。 After this command the folder "material" in node_modules/@angular was added.
在此命令之后,添加了node_modules / @ angular中的文件夹“material”。
my package.json is: 我的package.json是:
{
"name": "user-manager",
"version": "1.0.0",
"scripts": {
"start": "tsc && concurrently \"tsc -w\" \"lite-server\" ",
"lite": "lite-server",
"postinstall": "typings install",
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings"
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/angular/angular.io/blob/master/LICENSE"
}
],
"dependencies": {
"@angular/common": "~2.1.0",
"@angular/compiler": "~2.1.0",
"@angular/core": "~2.1.0",
"@angular/forms": "~2.1.0",
"@angular/http": "~2.1.0",
"@angular/material": "^2.0.0-alpha.9-3",
"@angular/platform-browser": "~2.1.0",
"@angular/platform-browser-dynamic": "~2.1.0",
"@angular/router": "~3.1.0",
"@angular/upgrade": "~2.1.0",
"angular-in-memory-web-api": "~0.1.5",
"bootstrap": "^3.3.7",
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.8",
"rxjs": "5.0.0-beta.12",
"systemjs": "0.19.39",
"zone.js": "^0.6.25"
},
"devDependencies": {
"concurrently": "^3.0.0",
"lite-server": "^2.2.2",
"typescript": "^2.0.3",
"typings": "^1.4.0"
}
}
app.module.ts: app.module.ts:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './components/app/app.component';
import { MaterialModule } from '@angular/material';
@NgModule({
imports: [ BrowserModule, MaterialModule.forRoot() ],
declarations: [ AppComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule { }
Can you help me, pls? 你能帮我吗,请问?
Update 更新
Since 2.0.0-beta.1 rebar-teacup 自2.0.0-beta.1 rebar-teacup
'@angular/material': 'npm:@angular/material/bundles/material.umd.js'
Previous version 以前的版本
Change your systemjs config like: 更改您的systemjs配置,如:
map: {
app: 'app',
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
...
'@angular/material': 'npm:@angular/material/material.umd.js', <== add this line
},
See also Angular2 Material Design alpha.9-3 has '404 not found' for @angular/material 另请参见Angular2 Material Design alpha.9-3 @ angular / material的'404 not found'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.