I wanna check if component has an attribute or not in Angular2. here is my component:
import { Component, OnInit, Input } from '@angular/core';
@Component({
selector: 'field-group, field-group[half]',
template: `
<div class="field-group">
<label *ngIf="label != ''">{{label}}</label>
<ng-content></ng-content>
<span class="validation" *ngIf="errorObject != ''"></span>
</div>
`
})
export class FieldGroupComponent implements OnInit {
@Input() label: string = '';
@Input() errorObject: any;
constructor() { }
ngOnInit() { }
}
For the selector I added [half]. now how can I check this component have this selector in code when I used? where can I check this exist or not? and how?
Thanks.