Angular2 / Ionic2 + ng2-dragula Has anyone earned?

I am trying to add drag and drop to ionic 2 application. But cannot make it work.

This is what I have done so far:

npm install ng2-dragula dragula --save

then on my page:

@Component({
  templateUrl: 'build/pages/dragtest/dragtest.html',
  directives: [Dragula],
  viewProviders: [DragulaService],
})
export class DragtestPage {
  constructor(private nav: NavController) {
  }
}

But when I add [dragula] tags, I get an error: Unable to bind "dragula" because it does not know the native property.

Has anyone helped with ion 2, are there any examples?

+4
source share
3 answers

I think you will skip the import statement:

import {DragulaService, Dragula} from 'ng2-dragula / ng2-dragula';

I already tried this, but it seems the IDE cannot find the "ng2-dragula" directory (red text in PHP Storm)

0

;) app.module.ts:

import { DragulaModule, DragulaService } from 'ng2-dragula/ng2-dragula';

:

imports: [
IonicModule.forRoot(MyApp),
DragulaModule
],

:

providers: [{provide: ErrorHandler, useClass: IonicErrorHandler}, DragulaService]

, :

import { DragulaService } from 'ng2-dragula/ng2-dragula';

:

constructor(private dragulaService: DragulaService ) {}

, , . ( , )

0

, ng-dragula ionic 2, ng-dragula github, , , , .

, ,

http://etenbo.com/add-drag-and-drop-on-ionic-2-by-plugin-dragula/

0

Source: https://habr.com/ru/post/1649403/


All Articles