简体   繁体   中英

Mdl-Select won't expand contract

so I'm stumped! I decided to try the Mdl-Select but the select stays permanently expanded and refuses to contract. My first thought was that something was installed incorrectly specifically the popover which I assume manages that part.

here is what I am doing.

app.module.ts

import { MdlModule } from '@angular-mdl/core'
import { MdlPopoverModule } from '@angular-mdl/popover';
import { MdlSelectModule } from '@angular-mdl/select';

systemjs.config.ts

'@angular-mdl/core': 'npm:@angular-mdl/core/bundle/core.js',
'@angular-mdl/popover': 'npm:@angular-mdl/popover/index.umd.js',
'@angular-mdl/select': 'npm:@angular-mdl/select/index.umd.js'

app.module.ts (which is consumed by main.ts)

import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { MdlModule } from '@angular-mdl/core'
import { MdlPopoverModule } from '@angular-mdl/popover';
import { MdlSelectModule } from '@angular-mdl/select';

@NgModule({
imports: [
    BrowserModule,
    FormsModule,
    ReactiveFormsModule,
    HttpModule,
    routing,
    MdlModule,
    MdlPopoverModule,
    MdlSelectModule
]

app.component.html

    <div>
        <mdl-select [(ngModel)]="user.SelectedFeature" placeholder="Feature">
            <mdl-option [value]><em>-- Select a Feature --</em></mdl-option>
            <mdl-option *ngFor="let feature of features" [value]="feature">{{feature}}</mdl-option>
        </mdl-select>
    </div>

features is a string[]

I am pretty much stumped here on what else to do... obviously I have other modules imported but nothing that isn't generic.

no errors are thrown.

静态图像

The issue was I missed adding the extra imports in my style sheet

issue resolved by adding the following to style.css

@import '~@angular-mdl/popover/popover';
@import '~@angular-mdl/select/select';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM