' "subscriptionKey" ' 不能分配给类型"身份验证类型"。Azure Maps with AngularJ



我在Angular中使用Azure地图,遇到了一个错误,我似乎找不到解决方案。根据在线的azures文档和示例,这似乎是正确的。无论如何,我授权我的azures订阅的代码如下

authOptions: {
authType: 'subscriptionKey',
subscriptionKey: this.key
}

当我运行我的angular应用程序时,它成功地编译了,但给了我一个错误,如下

ERROR in src/app/azureMap/azureMap.component.ts:34:9 - error TS2322: Type '"subscriptionKey"' is not assignable to type 'AuthenticationType'.
34         authType: 'subscriptionKey',
~~~~~~~~
node_modules/azure-maps-control/typings/index.d.ts:4071:9
4071         authType?: AuthenticationType;
~~~~~~~~
The expected type comes from property 'authType' which is declared here on type 'AuthenticationOptions'
AuthenticationType是authType属性的枚举。请改用AuthenticationOptions。例如:
authOptions: AuthenticationOptions = {
authType: <AuthenticationType>'subscriptionKey',
subscriptionKey: this.key
}

最新更新