angular - How to interpolate in Angular animation
问题描述
<ng-container *ngFor="let obj of mainData | keyvalue">
<span [@animate]="states.{{obj.key}}">
//////////////////////////////
</span>
</ng-container>
I get an error saying that "Expected expression, got interpolation"
解决方案
Brackets []
expect a expression, e.g. something like states.obj.key
, whereas on normal attributes you have to use interpolation {{}}
to insert an expression.
I think what you meant to write is either
[@animate]="states[obj.key]"
or
@animate="{{ states[obj.key] }}"
推荐阅读
- javascript - 合并 JSON 文件,不包括 JSON 字符串中的重复项
- javascript - discord.js 让机器人执行“@(输入命令的人)”
- assembly - 如何在 DOS/Asembler 中获取字母字符 (α)?
- vue.js - 使用 VueJs 在彼此没有任何关系的两个组件之间传输数据?
- ansible - ansible:如何执行仅安装在delegate_to上而不安装在控制器上的自定义模块?
- javascript - 在 firebase 云函数中使用 express `app.get()` 访问文件
- android - Android:如何使用 RSA 签名?
- android - 使用 CMake 为 Android 构建 C++ 时如何解决 pthread 和 posix 错误
- mysql - 使用 Hibernate Spatial 和 MySQL 进行属性转换
- c# - 无法从 .Net 5.0 WebApi 访问 GlobalConfiguration.Configuration