1

I'm attempting to use the ng2-tag-input library in my angular 2 application. I've run:

npm install ng2-tag-input --save

I verified that the file installed in the node_modules folder

I added the import statement to app.module.ts file:

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { TagInputModule } from 'ng2-tag-input';

I added it to imports section of the @NgModule

@NgModule({
    imports: [
        BrowserModule,
        FormsModule,
        HttpModule,
        TagInputModule,

At this point when I start the application I get an error:

GET http://localhost:3000/ng2-tag-input 404 (Not Found)
scheduleTask @ zone.js:1382
ZoneDelegate.scheduleTask @ zone.js:245
Zone.scheduleMacroTask @ zone.js:171
(anonymous) @ zone.js:1405
send @ VM104:3
fetchTextFromURL @ system.src.js:1156
(anonymous) @ system.src.js:1739
ZoneAwarePromise @ zone.js:518
(anonymous) @ system.src.js:1738
(anonymous) @ system.src.js:2764
(anonymous) @ system.src.js:3338
(anonymous) @ system.src.js:3605
(anonymous) @ system.src.js:3990
(anonymous) @ system.src.js:4453
(anonymous) @ system.src.js:4705
(anonymous) @ system.src.js:408
ZoneDelegate.invoke @ zone.js:232
Zone.run @ zone.js:114
(anonymous) @ zone.js:502
ZoneDelegate.invokeTask @ zone.js:265
Zone.runTask @ zone.js:154
drainMicroTaskQueue @ zone.js:401
ZoneTask.invoke @ zone.js:339
VM111:29 Error: Error: XHR error (404 Not Found) loading http://localhost:3000/ng2-tag-input
        at XMLHttpRequest.wrapFn [as _onreadystatechange] (http://localhost:3000/node_modules/zone.js/dist/zone.js:698:29)
        at ZoneDelegate.invokeTask (http://localhost:3000/node_modules/zone.js/dist/zone.js:265:35)
        at Zone.runTask (http://localhost:3000/node_modules/zone.js/dist/zone.js:154:47)
        at XMLHttpRequest.ZoneTask.invoke (http://localhost:3000/node_modules/zone.js/dist/zone.js:335:33)
    Error loading http://localhost:3000/ng2-tag-input as "ng2-tag-input" from http://localhost:3000/app/app.module.js

What am I doing wrong? Thanks in advance.

  • I assume you should add some lines to your System.js config as well. But can't advice on how to do it, since don't use System.js. Probably point module name to its UMD bundle. – Yaroslav Admin Dec 31 '16 at 14:17
  • 1
    Yeah, like Yaroslav said, if you are using SystemJS they should be added as here mentioned https://www.npmjs.com/package/ng2-tag-input – AT82 Dec 31 '16 at 14:18
  • even though SystemJS updates, I am not getting 404 not found error – Pravin Pawar Apr 07 '17 at 02:38

0 Answers0