AngularJS: How to set a variable inside of a template?

后端 未结 2 949
庸人自扰
庸人自扰 2021-01-30 10:05

How can I avoid having the {{f = ...}} statement in the third line print out the content of forecast[day.iso]?

I want to avoid using fore

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-30 10:23

    It's not the best answer, but its also an option: since you can concatenate multiple expressions, but just the last one is rendered, you can finish your expression with "" and your variable will be hidden.

    So, you could define the variable with:

    {{f = forecast[day.iso]; ""}}
    

提交回复
热议问题