node.js - ASP.NET MVC Angular 2 Failed to load resource: the server responded with a status of 404 (Not Found) -


i seeing odd behavior typescript imports in asp.net mvc using angular 2. following code errors @ run time reporting can't find ng2-highcharts package, root - not node_modules.

all other imports work - recognized relative node_modules.

code:

import {component, view, oninit} 'angular2/core'; import {ng2highcharts} "ng2-highcharts/ng2-highcharts"; import {core_directives, form_directives, ngclass} 'angular2/common'; import endpointservice  '../services/endpointservice';  //import {chart_directives} 'ng2-charts';  @component({     selector: 'index',     providers: [endpointservice],     templateurl: '/admin.portal/app/views/view-admin-users.html',     directives: [ng2highcharts] }) export class indexcomponent ... 

error: xhr error (404 not found) loading http://localhost/admin.portal/ng2-highcharts/ng2-highcharts.js(…)

run @ angular2-polyfills.js:138

tsconfig:

{   "compileroptions": {     "module": "system",     "sourcemap": true,     "noimplicitany": true   } } 

.csproj typescript settings

<typescripttarget>es5</typescripttarget>     <typescriptjsxemit>none</typescriptjsxemit>     <typescriptcompileonsaveenabled>true</typescriptcompileonsaveenabled>     <typescriptnoimplicitany>false</typescriptnoimplicitany>     <typescriptmodulekind>commonjs</typescriptmodulekind>     <typescriptremovecomments>false</typescriptremovecomments>     <typescriptoutfile />     <typescriptoutdir />     <typescriptgeneratesdeclarations>false</typescriptgeneratesdeclarations>     <typescriptnoemitonerror>true</typescriptnoemitonerror>     <typescriptsourcemap>true</typescriptsourcemap>     <typescriptmaproot />     <typescriptsourceroot />     <typescriptexperimentaldecorators>true</typescriptexperimentaldecorators> 

i've tried importing relative path, tsc fails. can help?

thanks in advance.

you should add map entry systemjs configuration. this:

<script>   system.config({     map: {       'ng2-highcharts': 'node_modules/ng2-highcharts',     },     packages: {       (...)     }   });   (...) </script> 

Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -