Closed wnvko closed 5 months ago
@wnvko @zdrawku note: what the generation requires to work this out is this provided on the value property:
/ @tsTwoWayProperty(true, "igcChange", "detail", false) /
this means that when igcChange is fired, we will look at the detail property on the custom event and propagate that outward to act as the new Value at the blazor level. This should also cause the ValueChanged event to be synthesized which is the other required part for the two way bind to work.
I am seeing that attribute in place for rating, so either something messed with the generation, or perhaps there was something wrong with the testing methodology and this is working?
Are there more parameters for how this was being tested? I essentially just tried the above and it seems to work fine to me.
@gmurray81 This is my code, it is really simple:
<IgbRating @bind-Value="_rating"></IgbRating>
<IgbRating Value="_rating" Change="@(e => _rating = e.Detail)"></IgbRating>
<p>Rating is @_rating</p>
...
@code {
private double _rating;
}
Note, if I set _rating
variable to some value both ratings above initialize correctly with the provided value. Only @bind
does not update the bound variable. I am using version 23.2.204.
Again pretty much this exact scenario worked fine for me against main, which should be roughly the same content as 204 as far as this scenario is concerned. Could you send the sample in full so that I can see what is different?
Here is the repo where I have the projects I am testing the two-way data banding - https://github.com/wnvko/two-way-binding Get it and open the Blazor folder. Inside is the Blazor project which is not working correctly.
@gmurray81 After restarting my VS and removing the bin/obj folder by hand it is working at my side now. Probably some bad caching :(
Closing this issue now.
Thank you for your time.
Description
I have a rating component bound to a variable via
@bind
.Steps to reproduce
Use code like this:
Result
Changing the value of the rating does not update the bound variable.
Expected result
Rating component should update the related bound variable. Note when using
Change
event it is working:This one works fine.