I started learning Angular2 and the latest angular4 a week ago, and now I need to create a custom structured directive that shows what's inside it.
Explanation: I have an array element of a pair of strings, let me call the first element of n elements of the array header, and the second description is the result of https://ibb.co/i23Dxa
(the array comes from the backend, I mimic it through the mock array file)
Now, if I name the structural directive that I need to create, I want it to show what I will write under this call
Example:
<ng-template aulos-configuration-item-toolbar>
<button (click)="click()">just click</button>
</ng-template>
this should only display the button that I wrote between the tags, for now I have this:
import { Directive, Input, TemplateRef, ViewContainerRef } from "@angular/core";
@Directive({
selector: "[aulos-configuration-item-toolbar]",
})
export class AulosConfigurationItemToolbar {
public templateRef: TemplateRef<any>;
constructor(templateRef: TemplateRef<any>) {
this.templateRef = templateRef;
}
}
Can someone explain to me how to proceed? Many thanks.