【发布时间】:2018-07-22 21:22:18
【问题描述】:
我在常量中有 regExp:
export const Constants = {
QUERY_PARAM_CONFIG: {
REGEX: /\+/gi,
REGEX_ENCODED: /%2B/g
}
};
但是当我运行 ng build 时出现错误:
ERROR in app\app.module.ts(58,21): Error during template compile of 'AppModule'
Expression form not supported in 'Constants'
'Constants' contains the error at app\configuration\constants.ts.
npm 构建脚本:
ng build --prod --output-hashing none --sourcemaps=true
有什么想法吗?
【问题讨论】:
-
问题可能出在您使用它的方式上,而不是您定义它的方式上。从您的 AppModule 发布代码。还要发布您正在执行的确切命令(例如
ng build与ng build --prod)。
标签: regex angular typescript angular-cli angular2-aot