0
I am developing a system, which lists logs and is doing the log listing correctly.
But there’s a mistake I don’t understand.
LogComponent.html:24 ERROR Error: InvalidPipeArgument: '[object Object]' for pipe 'SlicePipe'
at invalidPipeArgumentError (common.js:3953)
at SlicePipe.push../node_modules/@angular/common/fesm5/common.js.SlicePipe.transform (common.js:5317)
at Object.eval [as updateDirectives] (LogComponent.html:24)
at Object.debugUpdateDirectives [as updateDirectives] (core.js:10846)
at checkAndUpdateView (core.js:10243)
at callViewAction (core.js:10484)
at execComponentViewsAction (core.js:10426)
at checkAndUpdateView (core.js:10249)
at callViewAction (core.js:10484)
at execEmbeddedViewsAction (core.js:10447)
The class log.service.ts
export class LogService extends BaseService {
constructor(private httpClient: HttpClient, injector: Injector) {
super(injector);
}
getLogControlId(app_name: string): Observable<Log> {
return this.httpClient.get<Log>(ConfigService.getUrlControlId() + `${app_name}`).map(response => response as Log);
}
The class log.component.ts
export class LogComponent implements OnInit {
public titulo: string;
app_name: string;
log: Log;
constructor(
private router: Router,
private route: ActivatedRoute,
private logService: LogService) { }
ngOnInit(): void{
this.app_name = this.route.snapshot.params['app_name'];
this.log = new Log();
this.logService.getLogControlId(this.app_name).subscribe( data =>{
this.log = data;
});
}
pageSize = 20;
page = 1;
}
The class log.component.html
<tbody>
<tr *ngFor="let servico of log | slice: (page-1) * pageSize : (page-1) * pageSize + pageSize ">
<!-- <tr *ngFor="let servico of log"> -->
<th scope="row"></th>
<td>{{ servico.nome }}</td>
<td>{{ servico.date }}</td>
<td>{{ servico.texto }}</td>
</tr>
</tbody>
</table>
Why are you making this mistake and how can I fix it?
That’s exactly what the error shows:
Erro no arquivo LogComponent.html
on the line24
, the arguments passed to the pipeslice
of the archive Slicepipe are not correct!– LeAndrade