creativetimofficial / ct-paper-dashboard-pro-angular

8 stars 10 forks source link

Issues with class="selectpicker" not rendering #9

Closed knightshade23 closed 6 years ago

knightshade23 commented 6 years ago

If I navigate to a page that is using the class="selectpicker", the elements don't render. If I hit "F5" and refresh the page, they display.

I'm at a loss as to why they do not initially display - but it renders the class useless in my appliation. selectbroken selectrefresh

In case it matters, this is nested within a child component

knightshade23 commented 6 years ago

This can be closed.... Google was able to come up with a solution.

Sharing here, in case others encounter this

I added the following into my component.ts for the subcomponent:

declare var jQuery: any;

ngOnInit(): void {
    jQuery('.selectpicker').selectpicker();
}

Full context within the file below:

import { Component } from '@angular/core';

declare var jQuery: any;

@Component({
    moduleId: module.id,
    selector: 'legion-details-cmp',
    templateUrl: 'legiondetails.component.html'
})

export class LegionDetailsComponent{
    ngOnInit(): void {
        jQuery('.selectpicker').selectpicker();
    }
}