我在申请中使用了弱智。
我的构成部分班子
export class ExampleComponent {
selectedCoursesList: Course[] = [];
courseList: any[] = [];
removeCourse( course: Course) {
this.selectedCoursesList.forEach((item, index) => {
if (item === course) {
this.selectedCoursesList.splice(index, 1);
}
});
}
}
and my html is
<ng-select placeholder="Choose course" [multiple]="true"
(ngModelChange)="updatecourse($event);"
[(ngModel)]="selectedCoursesList">
<ng-option *ngFor="let course of courseList" [value]="course" >
{{course.name}}
</ng-option>
</ng-select>
在此,我要谈两点。
- Un-selecting particular selected values of ng-select
- 2 way Data binding
谁能告诉我我我我什么是错的?
感谢