2017-06-23 5 views
1

Ich versuche, Drag & Drop (https://github.com/akserg/ng2-dnd) in Angular-Projekt zu implementieren.ng2-dnd mit Angular 4

Meine config (ng -v):

@angular/cli: 1.1.3 
node: 6.10.1 
os: win32 x64 
@angular/animations: 4.2.4 
@angular/common: 4.2.4 
@angular/compiler: 4.2.4 
@angular/core: 4.2.4 
@angular/forms: 4.2.4 
@angular/http: 4.2.4 
@angular/platform-browser: 4.2.4 
@angular/platform-browser-dynamic: 4.2.4 
@angular/router: 4.2.4 
@angular/cli: 1.1.3 
@angular/compiler-cli: 4.2.4 
@angular/language-service: 4.2.4 

Meine Schritte:

  1. neues Projekt anlegen: ng new myProject --style=sass
  2. installieren NG2-dnd: npm install ng2-dnd --save
  3. Import DndModule in meine NgModule:

import { BrowserModule } from '@angular/platform-browser'; 
import { NgModule } from '@angular/core'; 
import { AppComponent } from './app.component'; 
import { DndModule } from 'ng2-dnd'; 

@NgModule({ 
    declarations: [ 
     AppComponent 
    ], 
    imports: [ 
     BrowserModule, 
     DndModule.forRoot() 
    ], 
    providers: [], 
    bootstrap: [AppComponent] 
}) 
export class AppModule { } 
  1. Import style.css von node_modules

Nach diesen Schritten, füge ich eine Vorlage nur wie bei Github, aber ohne Ergebnis. Ich sehe nur reinen Text, auch ohne Stil.

Was mache ich falsch?

+0

importieren sollten Können Sie Ihre Repo-Post an GitHub? – cgatian

+0

wo hast du Style importiert? – CharanRoot

+0

Ich importierte Stil in angular-cli.json, Hier ist mein Code: https://github.com/pawelidziak/my-todo-list –

Antwort

1

Sie Stil in Winkel cli.json

"styles": [ 
     "../node_modules/ng2-dnd/style.css", 
     ],