我如何更新 ngrx 商店 - 在 Angular UI 中单击按钮时

时间:2021-03-03 11:25:35

标签: angular ngrx-store

假设我在 ngrx/store 中有以下数据

{
  "id": 1,
  "containers": [
    {
      "id": 1.1,
      "x": 10,
      "y": 40
    },
    {
      "id": 1.2,
      "x": 40,
      "y": 30
    }
  ]
}

下面是UI中的代码

<button type="button" (click)='onclick(x, y)'></button>

 onclick(x, y){

   // For example if the value x and y are 20 and 20 then i want the update the json in ngrx store like this

{
  "id": 1,
  "containers": [
    {
      "id": 1.1,
      "x": 20, 
      "y": 20
    },
    {
      "id": 1.2,
      "x": 20,
      "y": 20
    }
  ]
}

}

我怎样才能达到这个结果,以便我可以在 ngrx 商店中更新相同的内容

0 个答案:

没有答案