Using DotNet.invokeMethodAsync in TypeScript RRS feed

  • Question

  • User-343630552 posted

    I need to invoke a Blazor Wasm method from my script code, and have been successful in doing that using the code below.  This works when the code is in a native JS file, but I get a compiler error (cannot find name 'DotNet') when I try to place it in a TypeScript file.  Is there some way to do this in TS?

    Thanks.  Steve

    DotNet.invokeMethodAsync('ME Web', 'PassBBDetailJsonArray', jsonBBDetailsArray)
            .then(function (result) { document.getElementById("msgGetBBDetails").innerText = result; })
            .catch((event) => { console.error('StaticBlazorMethod error'); });

    Friday, June 12, 2020 5:17 PM


All replies