Top "Angular2-directives" questions

Use for questions about Angular 2+ directives

Get reference to a directive used in a component

I have a component whose template looks something like this: <div [my-custom-directive]>Some content here</div> …

angular angular2-directives angular-template
Angular2, TypeScript, How to read/bind attribute value to component class (undefined in ngOnInit)

can someone please advice me how to read/bind attribute value to @component class, which seems to be undefined in …

typescript angular angular2-template angular2-directives
How to send a value from one component to another?

I make a componenet in which I have one input field and button.On click of button I am diplaying …

angular angular2-routing angular2-template angular2-directives
Dynamic routerLink value from ngFor item giving error "Got interpolation ({{}}) where expression was expected"

I'm trying to set the routerLink value in a directive based on a dynamic set of items from the component. …

angular angular2-directives
How to dynamically bind the value of a checkbox Angular 2

Hi all: I have a component. The component view has a table: <div class="container"> <h2>…

angular angular2-directives
How to display error message based on custom validation rules in Angular 2?

I am using a template-driven approach to building forms in Angular 2 and I have successfully created custom validators that I …

typescript angular angular2-template angular2-directives angular2-forms
How to trigger a change event manually - angular2

Given the following components: @Component({ selector: 'compA', template: template: `<compB [item]=item></compB>` }) export class CompA { …

angular typescript angular2-template angular2-directives
How to find the count of items in an ngFor after the pipes have been applied

I have an ngFor creating rows in a table that is both filtered and paged. <tr *ngFor="#d of …

angular angular2-directives
How to restrict special characters in the input field using Angular 2 / Typescript

I am new to Angular 2. I need to prevent special characters from being typed in the input field. If I …

html angular typescript angular2-directives
Angular2 Styles in a Directive

In the given examples of Attribute directives (i.e. a directive to add appearance/behaviour), we have a fairly simple …

angular angular2-directives