Skip to content

Instantly share code, notes, and snippets.

@skie
Last active November 4, 2016 22:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skie/631b7a6a04144051b54299891431fc57 to your computer and use it in GitHub Desktop.
Save skie/631b7a6a04144051b54299891431fc57 to your computer and use it in GitHub Desktop.
import { Component, OnInit, Input, ViewEncapsulation } from '@angular/core';
import { MetaModel } from '../models/meta-model';
import { Entity } from '../models/entity';
@Component({
selector: '[index-row-cells]',
encapsulation: ViewEncapsulation.None,
template: `
<td *ngFor="let field of model.fields">
<span *ngIf="!entity.isLink(field)">{{entity.valueFormatted(field)}}</span>
<span *ngIf="entity.isLink(field)">
<a href="#{{entity.viewLink(field)}}">{{entity.valueFormatted(field)}}</a>
</span>
</td>
<td [index-row-links]="entity" [model]="model"></td>
`,
inputs: ['model.model', 'entity.entity']
})
export class IndexRowLinksComponent implements OnInit {
@Input() model: MetaModel;
@Input('index-row-cells') entity: Entity;
constructor() { }
ngOnInit() { }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment