- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我运行了这个命令 ng build --prod
,但是我得到了这个错误 Property 'brand' does not exist on type
。
不知道为什么 data-on-color="brand"HTML 属性与此相关。
我试图将所有 data-on-color="brand"
重命名为其他名称。例如。 data-lon-color="brand"
然后AOT编译就可以了。
下面是文件 /theme/angular/default/src/app/theme/pages/components/base/base-bootstrap-notify/base-bootstrap-notify.component.html 的内容
,如错误中所述。
<div class="form-group m-form__group row">
<label class="col-form-label col-lg-3 col-sm-12">
URL Clickable
</label>
<div class="col-lg-4 col-md-9 col-sm-12">
<input data-switch="true" type="checkbox" data-on-color="brand" id="m_notify_url">
</div>
</div>
<div class="form-group m-form__group row">
<label class="col-form-label col-lg-3 col-sm-12">
Allow dismiss
</label>
<div class="col-lg-4 col-md-9 col-sm-12">
<input data-switch="true" type="checkbox" checked data-on-color="brand" id="m_notify_dismiss">
</div>
</div>
<div class="form-group m-form__group row">
<label class="col-form-label col-lg-3 col-sm-12">
Pause on hover
</label>
<div class="col-lg-4 col-md-9 col-sm-12">
<input data-switch="true" type="checkbox" data-on-color="brand" id="m_notify_pause">
</div>
</div>
下面是.ts文件BaseBootstrapNotifyComponent
import {Component, OnInit, ViewEncapsulation} from '@angular/core';
import {ScriptLoaderService} from '../../../../../_services/script-loader.service';
@Component({
selector: "app-base-bootstrap-notify",
templateUrl: "./base-bootstrap-notify.component.html",
styleUrls: ["./base-bootstrap-notify.component.scss"],
encapsulation: ViewEncapsulation.None,
})
export class BaseBootstrapNotifyComponent implements OnInit {
constructor(private _script: ScriptLoaderService) {
}
ngOnInit() {
}
ngAfterViewInit() {
this._script.load('app-base-bootstrap-notify',
'assets/demo/default/custom/components/base/bootstrap-notify.js');
}
}
最佳答案
Angular normalizes解析模板时的属性名
private _normalizeAttributeName(attrName: string): string {
return /^data-/i.test(attrName) ? attrName.substring(5) : attrName;
}
所以你的字符串变成了
<input on-color="brand">
注意:甚至 <div data-*ngIf="3">Hello</div>
将毫无问题地工作。
然后angular有两个选项来声明事件
1) (event)
2) on-event
因此 Angular 认为您使用 color
声明了输出事件姓名
<input (color)="brand">
对于 aot,你必须声明处理程序 brand
在您的组件中。
解决方法
<input [attr.data-on-color]="'brand'">
关于angular - 通过angular-cli AOT编译错误,与HTML属性data-on-color冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45256746/
我正在尝试从 Unity 发布到我的 iPhone 4s。构建成功,但我继续收到此消息: “在 aot-only 模式下运行时无法加载 AOT 模块‘Assembly-CSharp’,因为依赖项无法找
在听说了这么多有关 Angular AOT 模式的信息后,我想尝试一下。因此,我们将应用程序迁移到 Angular v4.1.2,并进行了所有必要的更改。当我尝试使用我的 webpack 配置文件中的
我有一个 C# 项目,我需要将其编译为 native 二进制文件。我在这里读过: http://www.mono-project.com/AOT Mono 可以将程序集预编译为两个选项之一: --ao
我搜索了很多关于这种伟大语言的信息,并在此页面上找到了自己 https://github.com/dart-lang/sdk/wiki/Snapshots但它没有回答一些问题: 快照和 AOT 有什么
我知道什么是字节码检测。它只是在运行时更改 .class 文件字节码,这似乎从 JDK 1.5 开始可用。但是,据说是在类加载期间而不是运行时。 现在我的问题是,什么是 AOT 或提前检测?相反的程序
我正在为我的应用程序构建一个插件系统。我读到任何人都可以反编译 .class 文件,因此我不得不使用 Ahead-Of-Time 编译器(对吗?)。问题是我需要动态加载一些插件类。现在,我正在将所有
我的问题是 Angular 模块之一无法在 Safari 浏览器中正常工作。 我有以下代码: @NgModule({ bootstrap: [ AppComponent ], impo
我在这里问是因为我无法在网上找到完整的文档。示例 here太简单了。我有一个包含多个组件和一些模块的应用程序。用ngc编译后,我有很多错误。我发现修复它们的方法是使用相对路径。因此,我在所有组件中都使
在使用 webpack 进行 AOT 构建后,bundle 将每个组件模板包含两次,使得 bundle 比需要的大得多,因为模板作为字符串包含在内,UglifyJS 无法缩小。 我希望组件模板被排除为
我正在尝试使用 ngc 编译 angular 2.4.4: Error: Error encountered resolving symbol values statically. Expressio
当我这样做时,有什么原因(我可以解决): ngc -p tsconfig.aot.json 作为回应,它要求: 姓名: ngc 似乎忽略了我的 tsconfig.aot.json。 这可能是什么原因?
我正在开发一个 Angular 7 应用程序,除了加载问题外它工作正常,在研究中我发现我应该使用 AOT 构建而不是 JIT 或正常构建,由于应用程序规模巨大,我无法进行 aot 构建,它正在返回堆我
我在 Dynamics AX 2012 中有一个 AOT 查询,它由 HcmWorker 和 HcmEmployment 表(等等)组成。我的问题是,当我创建报告(不是 SSRS)或以其他方式使用此查
有谁知道在使用带有 AOT 编译的 Angular CLI 时如何获得更详细的错误堆栈跟踪?使用 JIT 编译运行时,我的应用程序没有问题,但是当我运行 ng build --aot 时,我得到的只是
我想查询 AOT 以查看是否存在使用 X++ 的表名。谁能指出我正确的方向或提供一些示例代码来做到这一点? 如果表存在并提供名称 (str tableName),则返回 true;否则,返回false
我有一个 Angular 5 应用程序,当我在测试模式下运行时没有问题,也就是说,当我使用 ng serve 命令在本地运行应用程序时。但是,当我在生产模式下部署应用程序时,即通过命令ng build
语境 我正在创建一个 Angular 应用程序的桌面版本,为此我正在使用 Electron 。 打开主窗口非常简单: win = new BrowserWindow({ width: 1280
我有一个看起来像这样的错误处理程序: @Injectable() export class GlobalErrorHandler implements ErrorHandler { construct
当我尝试构建启用了 AOT 选项的 Android 应用程序时,收到以下错误消息。 Invalid command line switch for "aapt.exe". VersionCode is
我在我的 Angular 2 应用程序中使用 Highcharts 和 Kendo Charts,当我尝试运行 AOT 编译时,它会抛出类似的错误 Cannot Import Module 或 Hom
我是一名优秀的程序员,十分优秀!