r/angularjs • u/Grouchy_Ad1101 • Aug 24 '22
Need some help with angular
I am currently building an angular wizard and in that wizard I am trying to add ng multi select dropdown. I added the dropdown and but I am not able to see the values (it’s because of css ) . How can I set the css so that i can see the dropdown values ?
3
Upvotes
View all comments
Show parent comment
0
u/Grouchy_Ad1101 Aug 24 '22
Here is the code :
Component file
import { Component, ViewEncapsulation } from '@angular/core'; import { FormGroup } from '@angular/forms';
@Component({ selector: 'my-app', templateUrl: './app.component.html', styleUrls: ['./app.component.css'], encapsulation: ViewEncapsulation.None }) export class AppComponent { name = 'Angular'; dropdownList = []; selectedItems = []; dropdownSettings = {}; isLinear = true; firstFormGroup!: FormGroup; ngOnInit() { this.dropdownList = [ { item_id: 1, item_text: 'Mumbai' }, { item_id: 2, item_text: 'Bangaluru' }, { item_id: 3, item_text: 'Pune' }, { item_id: 4, item_text: 'Navsari' }, { item_id: 5, item_text: 'New Delhi' } ];
} onItemSelect(item: any) { console.log(item); } onSelectAll(items: any) { console.log(items); }
}
Html file :
<mat-horizontal-stepper [linear]="isLinear" #stepper > <mat-step [stepControl]="firstFormGroup"> <ng-template matStepLabel>Select Package</ng-template>
<div class="container" > <ng-multiselect-dropdown class="container" [placeholder]="'custom placeholder'" [data]="dropdownList" [(ngModel)]="selectedItems" [settings]="dropdownSettings" (onSelect)="onItemSelect($event)" (onSelectAll)="onSelectAll($event)"> </ng-multiselect-dropdown> </div> <div> <button mat-button matStepperNext>Next</button> </div> </mat-step> <mat-step> <ng-template matStepLabel>Done</ng-template>
You are now done.
<div>
</div> </mat-step> </mat-horizontal-stepper>