creativetimofficial / ct-paper-dashboard-pro-angular

8 stars 10 forks source link

The customizable select does not work with angular for #7

Closed criti18 closed 6 years ago

criti18 commented 6 years ago

The single select and the multiple select don't work with the angular cycles. The data just doesn't appear in the options, I have tried with local arrays and I get the same result. It's important that this works with the NGFor because I receive information by the webservices.

chelaruc commented 6 years ago

Hi, @criti18! Thank you for using our product! Can you init bootstrap select picker in AfterViewInit? Like:

ngAfterViewInit(){
        //  Init Bootstrap Select Picker
        if($(".selectpicker").length != 0){
            $(".selectpicker").selectpicker({
                iconBase: "ti",
                tickIcon: "ti-check"
            });
        }

    }

And don't forget to import AfterViewInit. Tell me if it worked.

All the best, Ciprian

criti18 commented 6 years ago

I tried, but I have the same result the select disappears with any ngIf, any ideas?

chelaruc commented 6 years ago

@criti18 I've made some tests and I'm thinking this is a solution: For .ts:

screen shot 2017-12-13 at 10 51 35

For .html:

screen shot 2017-12-13 at 10 53 26

And delete:

//  Init Bootstrap Select Picker
        if($(".selectpicker").length != 0){
            $(".selectpicker").selectpicker({
                iconBase: "ti",
                tickIcon: "ti-check"
            });
        }

Tell me if it worked!

Best, Ciprian

Sauravsam85 commented 6 years ago

Did this ever work for web services?

chelaruc commented 6 years ago

@Sauravsam85 we are not working with web services, that's why I can't tell you for sure if it's working. Best, Ciprian