0

I'm working on an application and I'm trying to format the report links how I want them. Ideally, there should be 3 or 4 rows, and at least 6 columns wide. I know I have to use a pipe to help with the formatting, I just cannot get the logic down. I tried using the pipe from another angular answer, however, it does not work (no rows will show).

Here is a code sample of my Angular 6 code:

<table>
  <tr *ngFor="let report of annualReports">
    <td><a href="#">{{ report.rptDisplayName }}</a> </td>
  </tr>
</table>

and the pipe:

@Pipe({ name: 'pairs' })
export class PairsPipe implements PipeTransform {
  transform(value: any) {
    return value.filter((v, i) => i % 2 == 0).map((v, i) => [value[i * 2], value[i * 2 + 1]])
  } 
}
4
  • 1
    did you apply 'pairs' in the HTML code? Also, using css grid or bootstrap might be easy to achieve the same effect. Commented Oct 4, 2018 at 23:21
  • when I change it to | pairs, I get no results. However, I can breakpoint the pipe and see it's being called, just nothing is returned and I'm not 100% sure how to change the map to have the correct formula. Commented Oct 4, 2018 at 23:36
  • thanks, the answer was css-grid. if you want to post an answer i'll accept it. Commented Oct 4, 2018 at 23:50
  • cool, will do that. thanks! Commented Oct 4, 2018 at 23:52

1 Answer 1

0

did you apply 'pairs' in the HTML code? Also, using CSS Grid or bootstrap might be easy to achieve the same effect.

Sign up to request clarification or add additional context in comments.

1 Comment

The answer here was utilizing a css-grid layout to perform what I needed!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.