Why is colspan not a known native attribute in Angular 2?
In order to understand it, we need to have a clear in-depth knowledge between Document Object Model(DOM) and HyperText Markup Language(HTML).
Basically, DOM is a model of objects and is a logical tree representation of the document whereas HTML is a markup language that we used to build web-pages.
Every HTML attributes have one to one mapping to properties of DOM objects.
Example: First Name
So, The above example contains two tags label and input. As we can observe, there is an attribute defined inside the input tag which is “disabled”.
Similarly, if you talk about DOM properties, disabled is also present inside the input object.
But they are cases where some attributes of HTML tags are not available inside the DOM.
Example: colspan. Like colspan, So when you try to use them for attribute binding in Angular 2+, you will get an error which says “can’t bind to colspan since it isn’t a known property of ‘td’ “.
Similarly, we have some properties which are defined in DOM but are not present in HTML.
In order to use them for attribute binding you need to use the following syntax “[attr.colspan]”.