客户端.js
async function callClientAsyncFuncWithResult () {
let result = await someService.request();
return result;
}
Run Code Online (Sandbox Code Playgroud)
页面.dart
import 'dart:js' as js;
var result = js.context.callMethod('callClientAsyncFuncWithResult');
//I want to do something like var result = await js.context.callMethod('callClientAsyncFuncWithResult');
Run Code Online (Sandbox Code Playgroud)
在 AngularDart 中,您如何在继续执行 dart 之前等待客户端 javascript Promise 返回结果?现在它只是流过调用,我已经尝试将 callMethod 的结果设置为 Future 或 Promise 并且它从不等待。
我不认为我的实现是正确的。我怎样才能做到这一点?
我有一个包含枚举的BatchInfoViewModel类:
namespace MyStuff.ViewModel
{
public class BatchInfoViewModel : ObservableObject
{
public enum TimeFrame
{
Today,
Last7days,
Last30days,
Last6months,
Last12months,
All
}
}
}
Run Code Online (Sandbox Code Playgroud)
和一个用户控件'BatchInfoView'使用BatchInfoViewModel,我试图将此视图中的组合框绑定到模型上的TimeFrame枚举,但我发现的每个资源都显示了我认为我正在使用的方法,但我在运行时一直收到Type not found例外.
<UserControl x:Class="MyStuff.View.BatchInfoView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:view="clr-namespace:MyStuff.View"
xmlns:viewModel="clr-namespace:MyStuff.ViewModel;assembly=MyStuff.ViewModel"
xmlns:sys="clr-namespace:System;assembly=mscorlib">
<UserControl.Resources>
<ObjectDataProvider x:Key="EnumDataProvider"
MethodName="GetValues"
ObjectType="{x:Type sys:Enum}">
<ObjectDataProvider.MethodParameters>
<!--None of these work at all, I'm lost :( I've tried variations of these: -->
<!--<viewModel:BatchInfoViewModel></viewModel:BatchInfoViewModel>
<x:Type TypeName="viewModel:TimeFrame"/>
<x:Type TypeName="BatchInfoViewModel:TimeFrame"/>-->
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
Run Code Online (Sandbox Code Playgroud)
它找不到类型并将抛出异常.
因此,我有一个新创建的netcore应用程序,它通过中间件设置链接到我的azure Active Directory帐户,如下所示:
app.UseCookieAuthentication(new CookieAuthenticationOptions()
{
AutomaticAuthenticate = true,
AutomaticChallenge = true
});
app.UseOpenIdConnectAuthentication(new OpenIdConnectOptions
{
AutomaticAuthenticate = true,
AutomaticChallenge = true,
ClientId = Configuration["Authentication:AzureAd:ClientId"],
Authority = Configuration["Authentication:AzureAd:AADInstance"] + Configuration["Authentication:AzureAd:TenantId"],
CallbackPath = Configuration["Authentication:AzureAd:CallbackPath"],
Events = new OpenIdConnectEvents
{
OnAuthenticationFailed = OnAuthenticationFailed,
OnAuthorizationCodeReceived = OnAuthorizationCodeReceived
}
});
Run Code Online (Sandbox Code Playgroud)
我的回调路径默认为“ CallbackPath”:“ / signin-oidc”,我在URL上的天蓝色符号为http:// localhost:20352 / ,回复URL为http:// localhost:20352 / signin-oidc
现在,我可以正常进行登录过程了,但是如果您按几次浏览器后退按钮,我将被炸死:
处理请求时发生未处理的异常。
例外:关联失败。位置不明
AggregateException:未处理的远程故障。(关联失败。)Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler`1.d__5.MoveNext()
如何或在何处捕获此异常以进行相应处理?或导致此问题的中间件设置有问题。
上面的两个事件从未发生过。
编辑:可能有助于了解来自浏览器后退按钮的爆炸URL是“ http:// localhost:20352 / signin-oidc ”
这显然不存在为有效的控制器/动作路线