dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.36k stars 9.99k forks source link

Using RobinHerbots inputmask in ClientSideBlazor #13236

Closed toto-tech closed 4 years ago

toto-tech commented 5 years ago

I want to use inpunmask in clientside blazor. Problem is that two way binding not work. My code is folllowing: I include this js libs:

<script src="script/jquery-3.4.1.min.js"></script>
<script src="script/jquery.inputmask.min.js"></script>
<script src="script/inputmask.binding.js"></script>
<script src="script/InitMask.js"></script>

My js code: window.datetimeinput = {

initjs: function () {

            //$("#phone").inputmask();
        $("#phone").inputmask("99-9999999");

}
};

My blazor code:

@code{ public Model model = new Model();

public class Model
{

    public string phone { get; set; }
}

protected override async Task OnAfterRenderAsync()
{
    await js.InvokeAsync<object>("datetimeinput.initjs");

}

}

hetis commented 5 years ago

Please help

mkArtakMSFT commented 5 years ago

Thanks for contacting us, @toto-tech. If that library directly manipulates the DOM, you're going to have problem with integrating it with Blazor, because it'll interfere with Blazor's diffing logic and result in unexpected (for Blazor) outcomes.

toto-tech commented 5 years ago

Thanks for your answer. What can be best practise to mask inputs generally

ghost commented 4 years ago

Thank you for contacting us. Due to no activity on this issue we're closing it in an effort to keep our backlog clean. If you believe there is a concern related to the ASP.NET Core framework, which hasn't been addressed yet, please file a new issue.