API Documentation and Element Attributes


When I read the API documentation for something like GridLayout I don’t see that it documents it supports the ‘class’ attribute. I do see scaleX and scaleY are documented as properties which are used as attributes in the markup. What am I missing?

Following snippet example from the sampleGroceries app

 <GridLayout #background


This is actually quite an interesting case.

If you look at this page you can see this:

So there’s indeed scaleX and scaleY, but there’s also className, but no class.

I think that’s because class is a reserved keyword in many languages. It is listed for TypeScript here and that site also links to an ES6 reserved keyword list that also includes class. So you can’t use public class: string here.

But why can you use class as a property then? Well, that’s because our NativeScript friends have provided us with a convenience setter and getter!

At least, that’s what I think how this came to be…