sprocketholer
sprocketholer

Reputation: 101

importing external libraries ng2-tag-input into Angular 2

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.

Upvotes: 1

Views: 379

Answers (0)

Related Questions