javascript - Use ng2-material in angular 2.1.x project -
i'm trying use library in angular2 project looks trully amazing. i've managed set (and use) basic angular material library can't managed add ng2-material on top of it. think have problem systemconfig
loader can't fix it: (index):19 error: (systemjs) xhr error (404 not found) loading http://localhost:3000/ng2-material(…)
here package.json file:
"dependencies": { "@angular/common": "~2.1.1", "@angular/compiler": "~2.1.1", "@angular/core": "~2.1.1", "@angular/forms": "~2.1.1", "@angular/http": "~2.1.1", "@angular/material": "^2.0.0-alpha.10", "@angular/platform-browser": "~2.1.1", "@angular/platform-browser-dynamic": "~2.1.1", "@angular/router": "~3.1.1", "@angular/upgrade": "~2.1.1", "@angular2-material/core": "^2.0.0-alpha.8-2", "angular-in-memory-web-api": "~0.1.13", "body-parser": "^1.15.2", "bootstrap": "^3.3.7", "components-font-awesome": "^4.7.0", "core-js": "^2.4.1", "express": "^4.14.0", "hammerjs": "^2.0.8", "jquery": "^3.1.1", "ng2-material": "^0.8.1", "reflect-metadata": "^0.1.8", "rxjs": "5.0.0-beta.12", "sqlite3": "^3.1.8", "systemjs": "0.19.39", "zone.js": "^0.6.25" }, "devdependencies": { "@types/body-parser": "0.0.33", "@types/core-js": "^0.9.34", "@types/express": "^4.0.33", "@types/jasmine": "^2.5.37", "@types/jquery": "^2.0.33", "@types/node": "^6.0.46", "@types/sqlite3": "^2.2.31", "codelyzer": "^1.0.0-beta.3", "concurrently": "^3.0.0", "jasmine-core": "~2.4.1", "karma": "^1.3.0", "karma-chrome-launcher": "^2.0.0", "karma-cli": "^1.0.1", "karma-htmlfile-reporter": "^0.3.4", "karma-jasmine": "^1.0.2", "karma-jasmine-html-reporter": "^0.2.2", "karma-mocha-reporter": "^2.2.0", "tslint": "^3.15.1", "typescript": "^2.0.7" }
i've updated app.module.ts file (after digging in issue):
import {materialmodule} '@angular/material'; import {ng2materialmodule} 'ng2-material'; @ngmodule({ bootstrap: [appcomponent], declarations: [appcomponent], imports: [browsermodule, approutingmodule, httpmodule, materialmodule.forroot(), ng2materialmodule.forroot(), formsmodule], entrycomponents: [], providers: [], })
and systemjs.config.js file:
(function (global) { system.config({ paths: { 'npm:': 'node_modules/' }, // map tells system loader things map: { // our app within app folder app: 'dist', // angular bundles // ... basic angular here **// added make angular material work** '@angular/material': 'npm:@angular/material/material.umd.js', **// need here?** // other libraries 'rxjs': 'npm:rxjs', 'angular-in-memory-web-api': 'npm:angular-in-memory-web-api', }, // packages tells system loader how load when no filename and/or no extension packages: { ... stuff ... } }); })(this);
thanks lot help. i've been struggling of hours , don't see other leads explore.
Comments
Post a Comment