- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
当使用 ngModel
将值发射到属性从 bumpDetail.name
数组获取的 bump 对象时,我遇到了一些问题。
我已经在下面粘贴了我的代码片段。
谁能帮我检查一下,告诉我哪里做错了?谢谢。
<p *ngFor="let bumpDetail of bumpDetail">
<input type="checkbox" id="device" [(ngModel)]={{bump.bumpDetail.name}}/>
<label for="device">{{bumpDetail.name}}</label>
</p>
Bump[] = [{
"name": "bump_1",
"status": true
}, {
"name": "bump_2",
"status": false
}, {
"name": "bump_3",
"status": true
}]
这是错误。
Parser Error: Got interpolation ({{}}) where expression was expected at column 0 in [{{bumpDetail.name}}] in ng:///AppModule/SettingComponent.html@129:59 ("p *ngFor="let bumpDetail of bumpDetail">
最佳答案
[]
和 {{}}
从不一起使用。一个或另一个
[(ngModel)]="this[bumpDetail.name]"
{{}}
仅用于字符串插值。
关于angular - 带有动态变量的 ngModel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47221026/
我目前理解 [(ngModel)]="expression" 是从组件到 View 的双向绑定(bind),反之亦然。我也明白 [ngModel]="expression" 是单向绑定(bind)(我
我实际上是在重复一个 mat 输入字段,然后我用数组中对象的属性名称编写了 [(ngModel)] 作为 [(ngModel)] 的值 例如这是我拥有的对象数组: test = [{name: 'Ha
我正在观看的 Udemy Angular 6 视频显示使用第一种语法。但是,我使用 WebStorm 作为我的 IDE,当我使用 [(ngModel)]="variable" 语法时,它不会提供任何类
我正在尝试用 Angular 数组绘制 radioBoxes,然后获取选中的 radio 的值,但是模型不会改变它的值吗,有人可以帮我吗? HTML部分
我有以下 ckEditor 指令。底部是我从有关如何在编辑器中设置数据的示例中看到的两种变体: app.directive('ckEditor', [function () { return
这是一个模板示例: 这里他们两个做同样的事情。首选哪一个?为什么? 最佳答案 [(ngModel)]="overRideRate" 是 [ngModel]="overRideRate"的缩写形式
我得到的是一个动态生成的 ngModel 对象,并且某些不在顶层的属性仅在一个方向上绑定(bind)。 包括一个应该让事情变得更清晰的 plunkr,但我想做的是生成一个动态表单,并且如果属性嵌套在根
嗨,哪个更好?有什么区别?有什么优点和缺点? 这是两者的对比代码: 范围:{ ngModel:'=' } app = angular.module('app', []); a
我正在尝试根据 angularjs 中的某些属性绑定(bind)未知的数组索引。 //javascript method inside controller functio
我试图在 ngFor 循环中输入具有正则表达式要求的输入,但收到“无法读取未定义的属性‘有效’”错误,我将其用作页面加载时弹出的错误消息。 这是我目前的代码: (我拥有的键管道是一个自定义管道,因为
我正在尝试将 ngControl 表单验证添加到 Angualr js 2 中的 bootstrap 4 typehead 控件。代码如下。 {{ requ
[(ngModel)] 在表单标签内不工作 当我使用 Multi Select Outside Form 标签时,可以正常选择 All 和取消选择所有功能 但是当我把它放入 Form 里面时,它正在工
假设我想要一个指令,它接受用户在输入中键入的内容并将其转换为小写。 所以我想出了一个这样的指令(在这个 Plunker http://plnkr.co/edit/jnE3s8MRr1tFCX0WVYe
我的名为 datePicker 的指令位于输入元素上,它从模型中获取公历日期并将其转换为最终用户的波斯日期。 从 datePicker 更改日期(这里是 jalali(波斯日期选择器)),转换为 gr
在这个例子中,我看到了解释,但我仍然不确定我为什么在这种情况下将#name 模板变量设置为“ngModel”。如果有 2 或 3 个其他带有模板变量的输入字段,您是否也将它们的值设置为“ngModel
这是我的 HTML 代码: Start 因此,startDate 存储为数字(长整型),但我想显示本地日期时间。我真的不知道该怎么做。我使用相同的组件来创建和更新模型。创建工作正常,因为
喜欢在 this question ,我要加.error在表单域的父级 .control-group当scope.$invalid是真的。 但是,像 ng-class="{ error: formNa
我正在尝试为颜色选择器创建指令,但 ngModel 值的值未更新。知道出了什么问题吗? 这是我的代码: .directive('colpkr', [function () {
我不是 Angular 事件方面的专家,但这是我的问题。如果我运行以下代码,我基本上会用错误的信息更新后端,因为 item.their_platform 在 togglePlatform() 触发之前
我有这个数组试图在我的模板中显示,不知何故它无法正确显示。如果我这样做 [value],它将给我正确的值,但 ofc。不绑定(bind)到数组和值。 大批: {"pluNo":1,"pluName":
我是一名优秀的程序员,十分优秀!