javascript - ng2-smart-table getAll() 方法

标签 javascript angular

我需要能够从表中检索所有记录。我正在使用本地数据源。但不幸的是使用下面的代码,它返回空。有人可以建议吗?

  add($event) {
    $event.confirm.resolve($event.newData);
    this.source.getAll().then((data) => console.log(data));
  }

最佳答案

试试这个!

    let data = [];
    this.source.getAll().then(value => { 
        value.forEach(element => {
            data.push(element); 
        });;
    });

关于javascript - ng2-smart-table getAll() 方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47014429/

相关文章:

javascript - 为什么 Angular 让你将 $provide 服务注入(inject)到配置 block 中?

javascript - Masonry 具有异步图片加载功能

javascript - 使用 jQuery 提交按钮的替代方案

angular - Typescript/Angular 类型声明没用?

Angular 6 单元测试 : I want to stub a declared property for my test

javascript - 如何安全地存储 Discord(OAuth2) 用户的访问 token ?

javascript - 未捕获的语法错误 : await is only valid in async function (its in an async function though. ...)

angular - 使用我的 Angular 应用程序创建一个Docker容器

angular - 使用 firebase 在应用程序中路由无法正常工作

angular - 在 IE11 中单击 angular2 时选择输入文本字段中的文本