执行任务的角函数我不知道为什么是这个函数

学生

我有一个用 angular/node.js 编写的示例代码。我指出了执行任务的功能。我不知道为什么......或如何。

我能够浏览代码片段并通过添加 console.log() 并注销数据来确定记录,所以我知道我找到的函数是正确的,我只是不明白为什么,因为在 angular 中它被调用“delete()”但在函数中它被称为“deleteValue()”

这是角度,因为您可以看到 delete(row._id) 是被调用的 onclick 函数。

<div class="card-body">
  <ngx-datatable class='material' *ngIf="row"  [columnMode]="'force'" 
                 [headerHeight]="40"  [footerHeight]="40" [rowHeight]="'50'" 
                 [limit]="500000" [rows]='perm' [scrollbarH]="true"
                 #table [limit]="_limit" >
    <ngx-datatable-column prop="value" name="Name" [width]="130" 
                          [sortable]="true">
      <ng-template let-row="row" let-value="value" ngx-datatable-cell-template>
        {{row.value}}
      </ng-template>
    </ngx-datatable-column>
    <ngx-datatable-column prop="qty" name="Qty" [width]="130"             
                          [sortable]="true">
      <ng-template let-row="row" let-value="value" ngx-datatable-cell-template>
        {{row.qty}}
      </ng-template>
    </ngx-datatable-column>

    <ngx-datatable-column name="Action" [sortable]="false" [width]="75">
      <ng-template let-row="row" let-value="value" ngx-datatable-cell-template>
        <div class="justify-content-center align-items-center">
          <span class="col-md-4">
            <button class="btn btn-danger" (click)="delete(row._id)">
              Delete
            </button>
          </span>
        </div>
      </ng-template>
    </ngx-datatable-column>
  </ngx-datatable>
</div>

这是 nodejs 代码:

valueController.deleteValue= async (req)=>{
  try{
    var recordType = await valueModel.deleteValue({_id: req.params.id});
    console.log('Deleting record: ' + req.params.id);
    return recordType;
  } catch(error) {
    throw error;
  }
}

谢谢,

我期待该函数被称为 delete 而不是 deleteValue 这是如何工作的?

阿德里安·布兰德
(click)="delete(row._id)"

将在 Angular 组件上调用一个名为 delete 的方法,我们在这里看不到您的 Angular TypeScript,但该组件通常会调用 Angular 服务,然后该服务将对您的节点 api 进行 http 调用。

按钮上的点击功能不会直接调用 api。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

函数已执行,我不知道为什么

来自分类Dev

在执行这个程序时,char 函数会返回变量。我不知道为什么?

来自分类Dev

我不知道为什么我得到“未定义的不是函数”错误

来自分类Dev

我的质数函数坏了,但我不知道为什么

来自分类Dev

Python函数正在更改输入的值,但我不知道为什么

来自分类Dev

C ++ unordered_map emplace()函数抛出seg错误,我也不知道为什么

来自分类Dev

std :: sort函数未对向量进行排序,我也不知道为什么?

来自分类Dev

我不知道为什么在此python函数中出现索引错误?

来自分类Dev

我不知道为什么当构造函数执行相同的工作时我们需要此程序的二传手

来自分类Dev

不知道为什么这个模式后卫匹配

来自分类Dev

我不知道为什么这个画布为空

来自分类Dev

我不知道为什么这个static_assert()代码不起作用

来自分类Dev

我不知道为什么这个方法被调用两次

来自分类Dev

我不知道为什么这个 FFmpeg 命令在 android 中不起作用?

来自分类Dev

这个 for circle 无法删除列表中的每个相同元素,我不知道为什么

来自分类Dev

我不知道为什么这个查询意味着这句话

来自分类Dev

我不知道为什么这个动画有效

来自分类Dev

vue js v-for 指令中的函数调用使循环进入无限循环,我不知道为什么

来自分类Dev

我的for嵌套循环未执行,我也不知道为什么

来自分类Dev

我不知道为什么我得到AttributeError

来自分类Dev

我的陈述无效,我也不知道为什么

来自分类Dev

我不知道为什么我得到AttributeError

来自分类Dev

VLOOKUP给#N / A我不知道为什么

来自分类Dev

无限循环我不知道为什么(DichotomySearch)

来自分类Dev

PyGame不断崩溃,我不知道为什么

来自分类Dev

C ++ Segfault,我不知道为什么?

来自分类Dev

VLOOKUP给#N / A我不知道为什么

来自分类Dev

声音消失了,我不知道为什么

来自分类Dev

df挂起,我不知道为什么

Related 相关文章

  1. 1

    函数已执行,我不知道为什么

  2. 2

    在执行这个程序时,char 函数会返回变量。我不知道为什么?

  3. 3

    我不知道为什么我得到“未定义的不是函数”错误

  4. 4

    我的质数函数坏了,但我不知道为什么

  5. 5

    Python函数正在更改输入的值,但我不知道为什么

  6. 6

    C ++ unordered_map emplace()函数抛出seg错误,我也不知道为什么

  7. 7

    std :: sort函数未对向量进行排序,我也不知道为什么?

  8. 8

    我不知道为什么在此python函数中出现索引错误?

  9. 9

    我不知道为什么当构造函数执行相同的工作时我们需要此程序的二传手

  10. 10

    不知道为什么这个模式后卫匹配

  11. 11

    我不知道为什么这个画布为空

  12. 12

    我不知道为什么这个static_assert()代码不起作用

  13. 13

    我不知道为什么这个方法被调用两次

  14. 14

    我不知道为什么这个 FFmpeg 命令在 android 中不起作用?

  15. 15

    这个 for circle 无法删除列表中的每个相同元素,我不知道为什么

  16. 16

    我不知道为什么这个查询意味着这句话

  17. 17

    我不知道为什么这个动画有效

  18. 18

    vue js v-for 指令中的函数调用使循环进入无限循环,我不知道为什么

  19. 19

    我的for嵌套循环未执行,我也不知道为什么

  20. 20

    我不知道为什么我得到AttributeError

  21. 21

    我的陈述无效,我也不知道为什么

  22. 22

    我不知道为什么我得到AttributeError

  23. 23

    VLOOKUP给#N / A我不知道为什么

  24. 24

    无限循环我不知道为什么(DichotomySearch)

  25. 25

    PyGame不断崩溃,我不知道为什么

  26. 26

    C ++ Segfault,我不知道为什么?

  27. 27

    VLOOKUP给#N / A我不知道为什么

  28. 28

    声音消失了,我不知道为什么

  29. 29

    df挂起,我不知道为什么

热门标签

归档