javascript - HTML typescript Comparing values in declaration Syntax
问题描述
So right now I'm not sure of the syntax of comparing a value from TypeScript/JavaScript in HTML.
For example:
Typescript:
val1 = 0;
.HTML:
<ion-progress-bar class="my-bar" [color]="{{val1}} > 50 ? 'green' : 'red'" value={{val1}} ></ion-progress-bar>
I read some HTML documentation that said to use greater than symbol you'd use >
, but this didn't work at all.
I want the color to be green if val1 > 50
and red otherwise in HTML.
解决方案
推荐阅读
- docker - 在 RaspberryPi3 上设置 MediaWiki 时出现 Docker 解析错误
- java - 如何检查何时建立连接,如果我的世界玩家的会话作为原始玩家有效?
- java - Java 设计模式根据事件类型应用一组操作
- javascript - 检查对象是否具有打字稿中类的所有属性
- javascript - React js:如何通过升序和降序对API数据中的项目进行排序
- vue.js - VueJS 应用程序在本地主机中工作,但在开发环境中中断(甚至不是生产环境)
- javascript - 如何防止 Web 组件闪烁?
- javascript - 当我收到更多的 json 字符串时,如何尝试获取 json 字符串?
- javascript - 使用 AngularJS 和 Ionic 时出现错误“TypeError:无法读取未定义的属性‘电子邮件’”
- android - 橡皮擦工具只是将路径更改为黑色