앱ML API
AppML API는 AppML의 메서드와 속성을 정의합니다.
메서드와 속성은 무엇을 할 수 있습니까?
메서드와 속성을 사용하여 다음을 수행할 수 있습니다.
- AppML 애플리케이션 생성
- 데이터가 있는 피드 애플리케이션
- 웹 페이지에서 사용할 애플리케이션 데이터 가져오기
예시
new AppML() 은 새로운 AppML 객체를 생성합니다.
dataSource 는 AppML 객체의 데이터 소스를 설정합니다.
getData() 는 데이터를 가져옵니다.
data.records 는 데이터 레코드를 포함합니다.
레코드를 반복하고 HTML 요소에 내용을 표시할 수 있습니다.
예시
// Create an AppML object and fetch the data
myObj = new AppML();
myObj.dataSource = "https://www.w3schools.com/appml/customers.php";
myObj.getData();
// Locate the data records
myArr = myObj.data.records;
len = myArr.length;
// Display the records
for (i = 0; i < len; i++) {
txt += myArr[i].CustomerName + "<br>";
}
document.getElementById("demo").innerHTML = txt;
결과
Alfreds Futterkiste
Berglunds snabbköp
Centro comercial Moctezuma
Ernst Handel
FISSA Fabrica Inter. Salchichas S.A.
Galería del
gastrónomo
Island Trading
Königlich Essen
Laughing Bacchus Wine
Cellars
Magazzini Alimentari Riuniti
North/South
Paris spécialités
Rattlesnake Canyon Grocery
Simons bistro
The Big Cheese
Vaffeljernet
Wolski Zajazd
일부 AppML 메서드
Method | Description |
---|---|
new AppML() | Creates a new AppML object |
run() | Runs an application object |
appml("name") | Returns the appml object with the specified name |
displayMessage(text) | Displays a specified message. |
setError(no, description) | Sets a specified error and error description. |
일부 AppML 속성
Property | Description |
---|---|
appName | The application name (the container id) |
container | The application container element |
controller | The application controller |
data | The application data object |
dataSource | The application data source |
message | The application message |
일부 데이터 개체 속성
Property | Description |
---|---|
data.model | The application data model |
data.records | The application data records |