angular - 装饰器不支持函数调用,但调用了“NgForageModule”
问题描述
升级到 Angular 7 后,我无法使用 AOT(使用 Ionic)创建构建。
我跑ionic cordova build android
得到
ERROR in Error during template compile of 'AppModule'
Function calls are not supported in decorators but 'NgForageModule' was called.
app.module.ts:
import {NgForageModule, Driver} from 'ngforage';
...
imports: [
NgForageModule.forRoot({
name: 'next-storage',
driver: [
Driver.INDEXED_DB,
Driver.WEB_SQL,
Driver.LOCAL_STORAGE
]
}),
...
]
...
解决方案
我必须使用DEFAULT_CONFIG
提供的并将我的自定义配置imports
从providers
.
变化app.module.ts
:
import {Driver, NgForageOptions, DEFAULT_CONFIG} from 'ngforage';
...
const ngfRootOptions:NgForageOptions = {
name: 'next-storage',
driver: [
Driver.INDEXED_DB,
Driver.WEB_SQL,
Driver.LOCAL_STORAGE
]
};
...
providers: [
{
provide: DEFAULT_CONFIG,
useValue: ngfRootOptions
}
...
]
...
推荐阅读
- c# - Performance Profiler 中的 Samples 是什么意思?
- java - 分离 v/s 瞬态实体
- polymer-1.0 - Cypress.io UI 自动化上基于可重复使用聚合物的组件的问题
- sql-server - 如何通过 SSIS 中的参数设置文件源?
- java - 如何从运行其他节点的 JVM 在节点上创建进程
- azure-devops - Azure DevOps 部署到 Azure SQL 托管数据库
- appcelerator - Appcelerator Alloy 数据绑定——transfrom 被调用两次?
- python - 如何使用 2 个条件属性使用插入排序对 python 列表进行排序?
- javascript - 从 console.log 将正则表达式匹配传递给变量
- c# - 使用 C# 中的泛型将用户定义类型转换为另一个用户定义类型