Kết hợp với AngularJS

1. Kết hợp kiểu gán XML trực tiếp

 <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<div ng-app="myApp" ng-controller="namesCtrl">
<p>Danh sách nhân viên:</p>
<ul>
  <li ng-repeat="x in NhanVien | orderBy:'Tuoi'">
    {{ x.Ten + ', ' + x.Lop}}
  </li>
</ul>
</div>
<script>
angular.module('myApp', []).controller('namesCtrl', function($scope) {
    $scope.NhanVien = <iif-D>Data:FileXml<In>json</>/app_data/xml_data/hoso.xml</In></iif-D>;
});
</script>

2. Kết hợp kiểu tham chiếu qua chức năng module
Dùng chức năng Module từ iif, dữ liệu dạng thô, chưa xử lý

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>

<div ng-app="myApp" ng-controller="customersCtrl">
<table>
  <tr ng-repeat="x in names">
    <td>{{ x.Ten}}</td>
    <td>{{ x.Lop}}</td>
  </tr>
</table>

</div>

<script>
var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope, $http) {
    $http.get("/module/data/?file=/app_data/xml_data/hoso.xml")
    .then(function (response) {$scope.names = response.data;});
});
</script>

3. Kết hợp kiểu tham chiếu qua Query đã tạo
Dùng chức năng Module từ iif, kiểu này bảo mật, dữ liệu được xử lý
Tham khảo cách tạo Query: /iif-admin/cach-tao-query
Tạo 1 query có tên Plan:
<Query>
<ID>Q1</ID>
<Type>Xml</Type>
<Src>PlanMe</Src>
</Query>



 <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<div ng-app="myApp" ng-controller="customersCtrl">
<table>
  <tr ng-repeat="x in names">
    <td>{{ x.Name}}</td>
  </tr>
</table>

</div>

<script>
var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope, $http) {
    $http.get("/Adminxml/Query_Do.aspx?name=Plan&out=json")
    .then(function (response) {$scope.names = response.data.Q1;});
});
</script>

Mục liên quan: