SpreadJS Documentation > Developer's Guide > Managing Data > Using SpreadJS with AngularJS |
SpreadJS supports AngularJS.
AngularJS is a web application framework that uses JavaScript on the client side.
Use the following steps to use SpreadJS with AngularJS.
angular.module("myApp", ["gcspreadsheets", "module2","module3",...])
JavaScript |
Copy Code
|
---|---|
<gcspread-sheets id="ss"> <sheets> <sheet datasource="data" frozen-column-count="1"> <columns> <column dataField="country"></column> <column dataField="product"></column> </columns> </sheet> </sheets> </gcspread-sheets> |
The SPREAD, SHEET, and COLUMN are the basic elements with tag hierarchy. Other elements work by setting them. The main tag hierarchy is:
JavaScript |
Copy Code
|
---|---|
<gcspread-sheets> <sheets> <sheet> <columns> <column></column> </columns> </sheet> </sheets> </gcspread-sheets> |
If the element's setting is a simple type or it can be set as a simple string, it will be set as the element's attribute. A simple type can be number, string, Boolean, enum, font, lineBorder, and so on, as shown in the following example:
<default-style backcolor="#c6e0b4" font="large Meiryo" border="#8ea9db dashed"></default-style>
If the element's setting is an object type and it cannot be set as a simple string, it will be set as a child element of the basic element. The child element may have another child element. For example:
<column dataField="amount" width="100" read-only="true" >
<default-style formatter="#,##0.00">
<number-validator comparisonoperator="GreaterThan" value1="0"></number-validator>
</default-style>
</column>
The following topics list element directives.
The attribute name is case insensitive and supports using the '-' to split every word. For example, the following code result is the same:
<column dataField="country"></column>
<column datafield="country"></column>
<column DATAFIELD="country"></column>
<column data-field="country"></column>
<column Data-Field="country"></column>
The attribute value supports "{{binding}}" to bind the scope's data. For example, this is a column with the width bound to the columnWidth:
<column width={{columnWidth}} >
This is an HTML INPUT element that binds the columnWidth using ng-model.
Column Width: <input ng-model="columnWidth" />
The column width is resized automatically when you input a number in the input element.
If you put a spread directive element or attribute to another element that does not follow the element directives, it will not take effect. You cannot reorder, insert, or remove columns defined on the html tag. Doing so might cause a binding value error.