So I understand how basic property binding works in angular for elements like input, but I came across some code that was using node module ng-drag-drop
which comes with a set of its own custom directives. In html of a component there is a div element that uses one of the directives called droppable
and property binding [dragOverClass]="'drag-target-border-green'"
but DIV elements have no property like dragOverClass
. So where does it come from? The directive? I was checking angular docs for data binding and it says nothing about this, just basic property binding chapter with input value examples. Thanks for the help.
Asked
Active
Viewed 298 times
0

Limpuls
- 856
- 1
- 19
- 37
-
It is part of the directive a custom input. – Sir Catzilla Jan 09 '19 at 12:03
-
So is that still property binding? And can you elaborate a little bit more about directive custom input? If I didn't define directive name on DIV element, this binding would not be working, right? – Limpuls Jan 09 '19 at 12:05
-
2It is from the directive. see this [link](https://angular.io/guide/attribute-directives#binding-to-an-input-property) – benshabatnoam Jan 09 '19 at 12:05
-
No it wouldn't work. It's a bit complicated to explain as i'm not to experienced as i would like to be with directives. – Sir Catzilla Jan 09 '19 at 12:32
-
The custom inputs are used by the directive to morph itself based on the input given. Kind of like when you set a width on an element. "width" in that case is a input which is then used to determine the width of the element in question. Directives allow for customization of elements. – Sir Catzilla Jan 09 '19 at 12:36
-
Okay guys, so you say it's @Input binding for directives. I read the link about it on angular docs page. All clear. The only problem is that my `ng-drag-drop` module directives don't import and use @input decorator anywhere. How then does it work without it? It's just a bunch of properties like this `dragOverClass: string;` inside draggable.directive.d.ts file. – Limpuls Jan 09 '19 at 12:40