Javascript 如何使用数据绑定从用户输入中获取值,并使用{…}与内容进行多路播放

Javascript 如何使用数据绑定从用户输入中获取值,并使用{…}与内容进行多路播放,javascript,angular,typescript,data-binding,Javascript,Angular,Typescript,Data Binding,我有一个api响应,即产品的价格,{{price} 我有一个产品的数量增加和减少喜欢 <div class="number-input"> <h2>Price: {{price }}</h2> <button onclick="this.parentNode.querySelector('input[type=number]').stepDown()" >-</button>

我有一个api响应,即产品的价格,{{price}

我有一个产品的数量增加和减少喜欢

<div class="number-input"> <h2>Price: {{price }}</h2>
        <button onclick="this.parentNode.querySelector('input[type=number]').stepDown()" >-</button>
        <input #qty class="quantity" min="0" max="25" name="quantity" type="number" id="quan" ngModel>
         <button onclick="this.parentNode.querySelector('input[type=number]').stepUp()" class="plus">+</button>
      </div>
Price:{{Price}
-
+

我需要一些类似于
{{price*input.value}}
如何在angular(11)中实现这一点这是解决方案,请按照下面的链接进行操作。

您如何退回/装饰您的
价格
。它应该很简单,定义一个值为0的price公共变量(
public price:number=0
),然后在api中用返回值更新price的值。我可能还会在输入上使用
ngModel
进行双向绑定。然后您只需执行
{{price*quantity}}
标识符“quantity”未定义。组件声明、模板变量声明和元素引用不包含此类membererror TS2363:算术运算的右侧必须是“any”、“number”、“bigint”或枚举类型。33{{price*qty.value}}~~~~~~~~~~~~~~~~~~现在我已经编辑了我的问题,这就是它……在一个组件中,价格是get-req api的回应。仅此而已。我已更新了我的解决方案,请遵循该链接,您将理解@Raghuraman.nandrigal anna…请将该问题作为问题发布,并放置该链接,以便我可以提供帮助。