Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/30.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 未填充物料表_Angular_Angular Material_Angular Material Table - Fatal编程技术网

Angular 未填充物料表

Angular 未填充物料表,angular,angular-material,angular-material-table,Angular,Angular Material,Angular Material Table,我是个新手。我正在开发一个有2个组件的搜索页面。“搜索”和“搜索表”。searchtable正在使用物料表。 我试图用HTTP get的数据填充material表。但是material表只显示标题,而不显示数据 索赔编号 {{element.claim} 名称 {{element.firstName} 出生日期 {{element.formattedDateOfBirth}} 我已经修改了您分配给数据源的数据 this.personexternalservice .searchForPe

我是个新手。我正在开发一个有2个组件的搜索页面。“搜索”和“搜索表”。searchtable正在使用物料表。 我试图用HTTP get的数据填充material表。但是material表只显示标题,而不显示数据


索赔编号
{{element.claim}
名称
{{element.firstName}
出生日期
{{element.formattedDateOfBirth}}

我已经修改了您分配给数据源的数据

this.personexternalservice
  .searchForPerson(searchClaimNo, sDOB, searchSurname, searchFirstname)
  .then(persons => {
    this.dataSource.data = persons.map(person => {
      return {
        id: person.pctId,
        fullName: `${person.lastName}, ${person.firstName}`,
        claim: person.claim,
        formattedDateOfBirth: moment(person.dateOfBirth).format('Do MMMM YYYY')
      };
    });

    this.isBusy = false;
  })
  .catch((e: Error) => {
    this.isBusy = false;
  });

问题是您在将数据分配给数据源后正在序列化响应

我已修改了您分配给数据源的数据

this.personexternalservice
  .searchForPerson(searchClaimNo, sDOB, searchSurname, searchFirstname)
  .then(persons => {
    this.dataSource.data = persons.map(person => {
      return {
        id: person.pctId,
        fullName: `${person.lastName}, ${person.firstName}`,
        claim: person.claim,
        formattedDateOfBirth: moment(person.dateOfBirth).format('Do MMMM YYYY')
      };
    });

    this.isBusy = false;
  })
  .catch((e: Error) => {
    this.isBusy = false;
  });
问题是,在将数据分配给数据源之后,您正在序列化响应