I'm currently following the instructions on https://github.com/SortableJS/angular-sortablejs and I seem to be facing an issue with the systemjs.config.js file. My app is built using Ionic 3 and Angular 4.
To address this, I created a script called systemjs.config.js in the assets/js/ directory and then included it in my index.html file as the last line within the head section like so:
<script src="assets/js/systemjs.config.js"></script>
However, upon implementing this change, I encountered an error stating that System could not be found, which happens to be the final line in the script: System.config(config);
If I choose to ignore the above step, I inevitably come across a 'can't bind sortablejs property' error. Here's how my .ts and .html files appear:
<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'