如何根据通过打字稿显示的内容动态更改图标状态?

时间:2019-03-28 08:39:30

标签: javascript angular typescript command-line-interface

我正在使用材质图标的名称通过打字稿显示图标。我想根据情况更改图标。 就像在打字稿中说图标的名称是'power_off', if power is false then we want to use 'power_off' but if the power is true then we want to use 'power'。 我正在为该代码使用另一个组件,但该组件已与该组件连接,并且该组件中的名称已更改,但在视图中未更改。 这个你能帮我吗。 预先谢谢你。

{name: 'associateDriver', visible: true, tooltip: 'Associate Driver', icon: 'person', type: 'icon'},
                {name: 'associateServiceReminder', visible: true, tooltip: 'Service Reminder', icon: 'add_alert', type: 'icon'},
                {name: 'busStopStatus', visible: false, tooltip: 'Bus Stop Status', icon: 'pin_drop', type: 'icon'},
                {name: 'delete', visible: false, tooltip: 'Delete', icon: 'delete', type: 'icon'},
                {name: 'immobilize', visible: true, tooltip: 'Immobilize', icon: 'power_off', type: 'icon'}

1 个答案:

答案 0 :(得分:1)

我希望这个帮助

txdate