sample Json
{message:[{name:test1,desc:test1desc},{name:test2,desc:test2desc}]}
.js
.controller('cartCtrl', ['$scope', '$http', function ($scope, $http) {
$http({
method: 'POST',
url: URL,
data: $.param({
}),
headers: {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
}
}).success(function (response) {
$scope.itemList = response.message;
}).finally(function () {
});
}])
.directive('itemListRepeatDone', function () {
return function (scope, element, attrs) {
if (scope.$last) {
//생성이 끝난뒤 핸들링
}
}
})
.html
<div class="col-md-4 col-sm-6" ng-repeat="item in itemList" item-list-repeat-done>
<h4 data-name="product_name">{{ item.name }}</h4>
<p data-name="product_desc">{{ item.desc }}</p>
</div>
'FrontEnd > angularJS' 카테고리의 다른 글
ngRoute를 이용한 싱글 페이지 웹 앱 (0) | 2018.12.12 |
---|