I followed the instructions in angular material2 getting started to install @ angular / material. Through Atom, I updated package.json, app.module and outside of the Getting Started instructions, I updated systemjs.config as follows: '@ angular / material': 'node_modules / @ angular / material',
I get these errors: zone.js: 1274 GET http: // localhost: 3000 / node_modules / @ angular / material / 404 (not found)
(SystemJS) XHR error (404 not found) loading http: // localhost: 3000 / node_modules / @ angular / material (...)
I believe I traced this problem to the fact that many @ angular folders have a bundle subfolder containing the umd file, but the @ angular / material folder does not have a package subfolder. Therefore, the unpack function cannot find @ angular / material / material.umd.js
systemjs is outside my comfort zone, so I am not sure about this, but I cannot solve the 404 problem with the new alpha.9-3 file structure. Here is the corresponding code (other components not shown).
package.json
"@angular/material": "2.0.0-alpha.9-3",
app.module
import { MaterialModule } from '@angular/material'; @NgModule({ imports: MaterialModule.forRoot(),
systemjs.config
(function(global) { var map = { 'app': 'app', // angular bundles '@angular': 'node_modules/@angular', // other libraries 'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api', 'rxjs': 'node_modules/rxjs', '@angular/material': 'node_modules/@angular/material', }; var packages = { 'app': { main: 'main.js', defaultExtension: 'js' }, 'rxjs':{ defaultExtension: 'js' }, 'angular2-in-memory-web-api': { main: 'index.js', defaultExtension: 'js' }, }; var ngPackageNames = [ 'common', 'compiler', 'core', 'forms', 'http', 'platform-browser', 'platform-browser-dynamic', 'platform-server', 'router', 'upgrade', ]; //adding 'material' to the array causes a different 404 error function packIndex(pkgName) { packages['@angular/'+pkgName] = { main: 'index.js', defaultExtension: 'js' }; } function packUmd(pkgName) { packages['@angular/'+pkgName] = { main: 'bundles/' + pkgName + '.umd.js', defaultExtension: 'js' }; } var setPackageConfig = System.packageWithIndex ? packIndex : packUmd; ngPackageNames.forEach(setPackageConfig); var config = { map: map, packages: packages }; System.config(config); })(this); //end of function(global)
I checked the folder / file structure and @ angular / material / material.umd.js definitely exists. How to get rid of 404 not found?