AppML 데이터


AppML 주요 목적은 HTML 페이지에 데이터 를 제공하는 것입니다.


AppML을 데이터에 연결

  • AppML은 변수의 데이터를 표시할 수 있습니다.
  • AppML은 파일의 데이터를 표시할 수 있습니다.
  • AppML은 데이터베이스의 데이터를 표시할 수 있습니다.

JavaScript 객체를 사용하는 AppML

HTML과 데이터를 분리하는 일반적인 방법은 데이터를 JavaScript 개체에 저장하는 것입니다.

예시

<table appml-data="dataObj">
<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>

<script>
var dataObj = {
"records":[
{"CustomerName":"Alfreds Futterkiste","City":"Berlin","Country":"Germany"},
{"CustomerName":"Ana Trujillo Emparedados y helados","City":"México D.F.","Country":"Mexico"},
{"CustomerName":"Antonio Moreno Taquería","City":"México D.F.","Country":"Mexico"},
{"CustomerName":"Around the Horn","City":"London","Country":"UK"},
{"CustomerName":"B's Beverages","City":"London","Country":"UK"},
{"CustomerName":"Berglunds snabbköp","City":"Luleå","Country":"Sweden"},
{"CustomerName":"Blauer See Delikatessen","City":"Mannheim","Country":"Germany"},
{"CustomerName":"Blondel père et fils","City":"Strasbourg","Country":"France"},
{"CustomerName":"Bólido Comidas preparadas","City":"Madrid","Country":"Spain"},
{"CustomerName":"Bon app'","City":"Marseille","Country":"France"},
{"CustomerName":"Bottom-Dollar Marketse","City":"Tsawassen","Country":"Canada"},
{"CustomerName":"Cactus Comidas para llevar","City":"Buenos Aires","Country":"Argentina"},
{"CustomerName":"Centro comercial Moctezuma","City":"México D.F.","Country":"Mexico"},
{"CustomerName":"Chop-suey Chinese","City":"Bern","Country":"Switzerland"},
{"CustomerName":"Comércio Mineiro","City":"São Paulo","Country":"Brazil"}
]};
</script>

JSON 파일을 사용하는 AppML

HTML과 데이터를 분리하는 또 다른 일반적인 방법은 데이터를 JSON 파일에 저장하는 것입니다.

고객.js

{
"records":[
{"CustomerName":"Alfreds Futterkiste","City":"Berlin","Country":"Germany"},
{"CustomerName":"Ana Trujillo Emparedados y helados","City":"México D.F.","Country":"Mexico"},
{"CustomerName":"Antonio Moreno Taquería","City":"México D.F.","Country":"Mexico"},
{"CustomerName":"Around the Horn","City":"London","Country":"UK"},
{"CustomerName":"B's Beverages","City":"London","Country":"UK"},
{"CustomerName":"Berglunds snabbköp","City":"Luleå","Country":"Sweden"},
{"CustomerName":"Blauer See Delikatessen","City":"Mannheim","Country":"Germany"},
{"CustomerName":"Blondel père et fils","City":"Strasbourg","Country":"France"},
{"CustomerName":"Bólido Comidas preparadas","City":"Madrid","Country":"Spain"},
{"CustomerName":"Bon app'","City":"Marseille","Country":"France"},
{"CustomerName":"Bottom-Dollar Marketse","City":"Tsawassen","Country":"Canada"},
{"CustomerName":"Cactus Comidas para llevar","City":"Buenos Aires","Country":"Argentina"},
{"CustomerName":"Centro comercial Moctezuma","City":"México D.F.","Country":"Mexico"},
{"CustomerName":"Chop-suey Chinese","City":"Bern","Country":"Switzerland"},
{"CustomerName":"Comércio Mineiro","City":"São Paulo","Country":"Brazil"}
]
}

AppML을 사용하면 appml-data 속성에서 JSON 파일을 데이터 소스로 지정할 수 있습니다.

예시

<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>

데이터베이스를 사용하는 AppML

웹 서버의 약간의 도움으로 애플리케이션에 SQL 데이터를 제공할 수 있습니다.

이 예에서는 PHP를 사용하여 MySQL 데이터베이스에서 데이터를 읽습니다.

예시

<table appml-data="https://www.w3schools.com/appml/customers.php">
<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>

AppML의 힘

AppML의 힘을 발견하려고 합니다.

AppML은 다음에 대한 데이터, 컨트롤러 및 모델을 제공할 수 있습니다.

  • 매우 쉬운 HTML 애플리케이션 개발
  • 매우 쉬운 모델링, 프로토타이핑 및 테스트

HTML 페이지 안에 AppML 애플리케이션을 원하는 만큼 넣을 수 있습니다.

AppML은 페이지의 다른 부분을 방해하지 않습니다.

HTML, CSS 및 JavaScript에 대한 완전한 자유가 있습니다.

AppML은 전체 규모의 CRUD 웹 애플리케이션을 개발하는 데 사용할 수 있습니다.

CRUD : 생성 , 읽기 , 업데이트 , 삭제

 AppML의 강력한 기능을 알아 보려면 AppML 데모 보기 .