You store your dependencies in node_modules
folder. When you need them, you import them inside a file using import
statement. When compiled into JS, import
are usually replaced with require
.
When you code is being executed in a browser, you need a loader to load those files from node_modules
and such loader is SystemJS. Learn more why SystemJS is needed here. SystemJS needs to know the path to modules, that's why you need to add dependencies to system.config.js
.
However, angular-cli
uses webpack module bundler, which has its own built-in loader. When webpack bundles files, it resolves paths and inlines them into resulting bundle. That's why you don't need to add paths anywhere when using angular-cli
.
I just tried to use ng2-tag-input
with angular-cli
. Everything worked OK. I just imported the following into main module:
...
import {TagInputModule} from 'ng2-tag-input';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
@NgModule({
declarations: [
AppComponent
],
imports: [
...
TagInputModule, BrowserAnimationsModule
],
And installed @angular/animations
. And the following snippet worked OK:
@Component({
template: '<tag-input [(ngModel)]='items'></tag-input>',
...
})
export class AppComponent {
items = ['Pizza', 'Pasta', 'Parmesan'];
}
You also need to install @angular/animations