From 33fad499c17e578c55b9822c48e845df0a865931 Mon Sep 17 00:00:00 2001 From: pnogal <paulina.nogal@wisc.edu> Date: Fri, 9 Nov 2018 08:28:15 -0600 Subject: [PATCH] Include CdkDragDrop --- src/app/degree-planner/shared/shared.module.ts | 5 +++-- .../term-container/term-container.component.html | 4 ++-- .../term-container/term-container.component.ts | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/app/degree-planner/shared/shared.module.ts b/src/app/degree-planner/shared/shared.module.ts index 80ead02..adc9dc2 100644 --- a/src/app/degree-planner/shared/shared.module.ts +++ b/src/app/degree-planner/shared/shared.module.ts @@ -1,10 +1,11 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { CourseItemComponent } from './course-item/course-item.component'; +import { DragDropModule } from '@angular/cdk/drag-drop'; @NgModule({ - imports: [ CommonModule ], - exports: [ CourseItemComponent ], + imports: [ CommonModule, DragDropModule ], + exports: [ CourseItemComponent, DragDropModule ], declarations: [ CourseItemComponent ] }) diff --git a/src/app/degree-planner/term-container/term-container.component.html b/src/app/degree-planner/term-container/term-container.component.html index 02d8751..cdbb4b3 100644 --- a/src/app/degree-planner/term-container/term-container.component.html +++ b/src/app/degree-planner/term-container/term-container.component.html @@ -2,8 +2,8 @@ <div fxLayout="row" fxLayoutAlign="space-between stretch"> <h2>{{ term.termCode | getTermDescription }}</h2><p class="text-right semi-bold credits">Credits: 13</p> </div> - <div> - <app-course-item *ngFor="let course of courses" [course]="course" [status]="'complete'"></app-course-item> + <div cdkDropList> + <app-course-item *ngFor="let course of courses" [course]="course" [status]="'complete'" cdkDrag></app-course-item> <p *ngIf="!courses" class="no-courses text-center semi-bold">No Courses Taken</p> </div> </mat-card> \ No newline at end of file diff --git a/src/app/degree-planner/term-container/term-container.component.ts b/src/app/degree-planner/term-container/term-container.component.ts index 1c4e348..9a5ed3d 100644 --- a/src/app/degree-planner/term-container/term-container.component.ts +++ b/src/app/degree-planner/term-container/term-container.component.ts @@ -1,6 +1,7 @@ import { Component, Input } from '@angular/core'; import { Term } from '../../core/models/term'; import { Course } from '../../core/models/course'; +import { CdkDragDrop, moveItemInArray, transferArrayItem } from '@angular/cdk/drag-drop'; @Component({ selector: 'app-term-container', -- GitLab