Bol*_*and 6 javascript typescript angular
我也遇到了着名的错误"Error遇到静态解析符号值.不支持函数调用.在运行i18n时,考虑用引用函数替换函数或lambda,解析符号".我已经做了很多研究,而且我没有使用lambda函数.当我将以下import语句添加到我的基本模块时会发生这种情况:
export const mapsConfig = new LazyMapsAPILoaderConfig();
mapsConfig.apiKey = 'xyz';
// ... below is in import list
BingMapsModule.forRoot(config),
Run Code Online (Sandbox Code Playgroud)
我正在使用ng2-bingmaps,我也做出了贡献:https://github.com/youjustgo/ng2-bingmaps
奇怪的是,ng2-bingmaps中的JS代码无关紧要.如果我删除所有.js文件,我仍然会得到相同的错误!所以,它必须是ng2-bingmaps core.d.ts中的内容,如下所示:
/**
* ng2-bingmaps - Angular 2 components for Bing Maps
* @version v0.2.0
* @link https://github.com/youjustgo/ng2-bingmaps
* @license MIT
*/
import { ModuleWithProviders } from '@angular/core';
import { LazyMapsAPILoaderConfig } from './services/maps-api-loader/lazy-maps-api-loader';
export * from './directives';
export * from './services';
export declare const NG2_BINGMAPS_PROVIDERS: any[];
/**
* The ng2-bing-maps core module. Contains all Directives/Services/Pipes
* of the core module. Please use `BingMapsModule.forRoot(config)` in your app module.
*
* @experimental
*/
export declare class BingMapsModule {
static forRoot(config: LazyMapsAPILoaderConfig): ModuleWithProviders;
}
Run Code Online (Sandbox Code Playgroud)
当我只导入BingMapsModule(没有forRoot)时,它可以工作.
我检查了ng2-bingmaps中的所有提供程序,并且它们都没有在装饰器内部具有lambda函数.
我的基本模块定义:
@NgModule({
imports: [
// browser module, required to load in browser
BrowserModule,
// routing
RouterModule.forRoot(routes),
// angular forms
FormsModule,
// ng2-bingmaps
BingMapsModule.forRoot(mapsConfig),
// ng-bootstrap
NgbModule,
// http
HttpModule,
// Angulartics2
// Angulartics2Module.forRoot(),
// our custom modules for certain parts of our app
CreateBookingModule,
CommonModule
],
declarations: [
// all our components
],
bootstrap: [ ClientApp ],
providers: [
// our services
]
})
Run Code Online (Sandbox Code Playgroud)
最后我解决了,感谢@peeskillet的回答。
| 归档时间: |
|
| 查看次数: |
5571 次 |
| 最近记录: |