THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

AppML How To


How to build an AppML Application in 2 easy steps.


1. Create a Page Using HTML and CSS

HTML

<!DOCTYPE html>
<html lang="en-US">
<link rel="stylesheet" href="style.css">
<title>Customers</title>
<body>

<h1>Customers</h1>

<table>
<tr>
  <th>Customer</th>
  <th>City</th>
  <th>Country</th>
</tr>
<tr>
  <td>{{CustomerName}}</td>
  <td>{{City}}</td>
  <td>{{Country}}</td>
</tr>
</table>

</body>
</html>
Try It Yourself »
Note The {{ }} brackets are placeholders for AppML data.

CSS

body {
    font: 14px Verdana, sans-serif;
}
h1 {
    color: #996600;
}
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    border: 1px solid grey;
    padding: 5px;
    text-align: left;
}
table tr:nth-child(odd) {
    background-color: #f1f1f1;
}
Note Feel free to replace the CSS with your own favorite style sheet.

2. Add AppML

Use AppML to add data to your page:

Example

<!DOCTYPE html>
<html lang="en-US">
<title>Customers</title>
<link rel="stylesheet" href="style.css">
<script src="http://www.w3schools.com/appml/2.0.3/appml.js"></script>
<body>

<h1>Customers</h1>

<table appml-data="customers.js">
<tr>
  <th>Customer</th>
  <th>City</th>
  <th>Country</th>
</tr>
<tr appml-repeat="records">
  <td>{{CustomerName}}</td>
  <td>{{City}}</td>
  <td>{{Country}}</td>
</tr>
</table>

</body>
</html>
Try It Yourself »

AppML Explained:

<script src="http://www.w3schools.com/appml/2.0.3/appml.js"> adds AppML to your page.

appml-data="customers.js" connects AppML data (customers.js) to an HTML element (<table>).

In this case we have used a JSON file: customers.js

appml-repeat="records" repeats an HTML element (<tr>) for each item (records) in a data object.

The {{ }} brackets are placeholders for AppML data.