Topic: Default value select angular
Dragonnblack pro asked 7 years ago
Dawid Adach pro answered 7 years ago
<mdb-select [(ngModel)]="selectedCharacter" [options]="dateOptionsSelect" placeholder="Choose time period"></mdb-select>.ts file :
dateOptionsSelect= [ { value: '1', label: 'Today', selected: true }, { value: '2', label: 'Yesterday' }, { value: '3', label: 'Last 7 days' }, { value: '4', label: 'Last 30 days' }, { value: '5', label: 'Last week' }, { value: '6', label: 'Last month' } ]; selectedValue = '1';
Dragonnblack pro commented 7 years ago
Thank you, it is indeed logical to use ngModel ... I had not thought of it at all ...Iyan Labao commented 7 years ago
noob question, how to import FormsModule?Dawid Adach pro commented 7 years ago
import { FormsModule } from '@angular/forms';FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Resolved
- User: Pro
- Premium support: No
- Technology: MDB Angular
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No