i am following https://github.com/SortableJS/angular-sortablejs and the systemjs.config.js is where I am stuck. I have a ionic 3 angular 4 app.
I created a script named systemjs.config.js in my assets/js/ and then included it in my index.html as last line in the head section as
<script src="assets/js/systemjs.config.js"></script>
However, doing that it complains it could not find System. Which is the last line in the script System.config(config);
if i ignore above step then i end up can't bind sortablejs property error. my .ts and .html looks like below:
<h2>Drag / drop the item</h2>
<div [sortablejs]="items">
<div *ngFor="let item of items">{{ item }}</div>
</div>
<hr>
<h2>See the result</h2>
<div>
<div *ngFor="let item of items">{{ item }}</div>
</div>
.ts
import { Component, ViewChild, AfterViewInit } from '@angular/core';
@Component({
selector: 'dynamic-home',
templateUrl: 'dynamic-home.html'
})
export class DynamicHomeComponent implements AfterViewInit{
items = [1, 2, 3, 4, 5];
}
app.module.ts
import { SortablejsModule } from 'angular-sortablejs'
@NgModule({
declarations: [],
imports: [
SortablejsModule
]
dyamicHome.ts
import { sortablejs } from 'sortablejs'
i dont know what was the issue here so i ended up using something else called dragula https://github.com/valor-software/ng2-dragula
this worked like a charm