I am trying to build a custom datagrid that can display data either as cards or the more tradional table/list/grid. I can do it pretty easily if I do not want the templates to be customizable as shown in this plunker
Here I have a my-grid component that gets passed the data to be rendered. Then I loop over the data and render the card-view or list-view component depending on the desired view which is controlled by the view toggle (code in app/my-grid.ts file)
I want to provide the ability to pass in custom templates and I am thinking something like this:
<my-grid>
<card-view-template>
<template var-item>
<h4>{{item.name}}</h4>
{{item.home}}
</template>
</card-view-template>
<list-view-template>
<template var-item>
<span>{{item.name}}</span>
{{item.home}}
</template>
</card-view-template>
</my-grid>
How can I get to what I want from where I am at?
*ngFor. I had a brief look but don't have a working example of a custom implementation myself yet.