CompanyCard
In this first iteration, the CompanyCard is simply a HTML rendering that you can feed with JSON in various ways.
You can initialize a CompanyCard with the attribute
data-ts="CompanyCard"
.
Even without any data, the card takes on a cardlike appearance.
If you are using Angular or jQuery, you might like to feed the card through a JavaScript API, as we will see, you can however also embed the data directly in the markup.
Embedded JSON
Server-side devs and UX designers might like to embed the JSON in the HTML. Because this is JSON, you should use double quotes and omit trailing commas.
Encoded JSON
You can also embed the JSON in an attribute data-ts.render
. The JSON string
must be encoded in the format returned by method
encodeURIComponent(json);
Remember to trim()
the JSON string
before you encode it.
Render programatically
You can grab a hold of the card and instruct it to
render()
some JSON data.
We notice that the connection status is indicated by a number. The number matches an index in the following array, which declares the label and icon.
This array is crowdsourced. You can modify the array in your app, simply by copy-pasting the code above into your initialization script. You can also use numbers (instead of strings) to indicate size and industry.
If you provide a number instead of a string, we'll look it up in these lists.
You are also welcome to overwrite these arrays in your app. That's it for now.