클라이언트에서 각도로 앱을 개발 중입니다. ,socket.io없이 AngularJS에서 알림을 푸시 할 수 있습니까?
$scope.sortableArray = [
'One', 'Two', 'Three'
];
$scope.add = function() {
$scope.sortableArray.push('Item: '+$scope.sortableArray.length);
sortableEle.refresh();
}
$scope.dragStart = function(e, ui) {
ui.item.data('start', ui.item.index());
}
$scope.dragEnd = function(e, ui) {
var start = ui.item.data('start'),
end = ui.item.index();
$scope.sortableArray.splice(end, 0,
$scope.sortableArray.splice(start, 1)[0]);
$scope.$apply();
}
sortableEle = $('#sortable').sortable({
start: $scope.dragStart,
update: $scope.dragEnd
});
}
http://jsfiddle.net/dj_straycat/Q5FWt/3/
이 앱은 여러 사람 때문에 액세스 할 수 있습니다 :
<div ng-controller="SortableCTRL">
<ul id="sortable">
<li ng-repeat="item in sortableArray" ng-bind="item"></li>
</ul>
<button ng-click="add()">Add</button>
<hr>
<pre ng-bind="sortableArray|json"></pre>
</div>
JS : 응용 프로그램은, 이런 식으로 뭔가를 다시 정렬 할 수 있습니다 슬라이드 세트가 있습니다 슬라이드가 추가/재정렬 될 때 밀어 넣기 알림을받는 것이 유용 할 것입니다. 검색 할 때 socket.io가 올바른 방법임을 알았습니다. 그러나 내가 일하는 회사는 아직 socket.io를 승인하지 않았습니다. socket.io를 사용하지 않고이 작업을 수행 할 수있는 방법이 있습니까?
나는 같은 접근법을 생각했다. 내가 그걸해야만한다고 생각해. 감사합니다. – codewarrior