vladotesanovic / ngSemantic

Angular 2 building blocks :package: based on Semantic UI

Home Page:https://ng-semantic.herokuapp.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

2 way data binding for rating module

kvcpr opened this issue · comments

Hello,
There is no 2 way data binding for rating module, I think it will be very helpful if we can bind it.

Regards

@kacepe : Did you find any ways to do it. Because it will be really great full atleast if we can do it for [initialRating] attribute.

@kacepe : Did a little tweak in ng-semantic rating module. Not sure the right way to do it, but it works.

ngOnChanges(changes: SimpleChanges) {
    if(changes['initialRating'] != null){
        jQuery(this.rating.nativeElement)
            .rating({
                initialRating: changes['initialRating'].currentValue || 0,
                maxRating: this.maxRating || 5,
                onRate: (value: number) => {
                    this.onRate.emit(value);
                }
        });
    }
}