0
我試圖與Pusher和AngularJs建立聊天。AngularJS:指令隔離範圍
<div id="chats" ng-controller="ChatCtrl">
<chat chat-id="1" chat-name="Max"></chat>
<chat chat-id="2" chat-name="John"></chat>
<chat chat-id="3" chat-name="Susanne"></chat>
</div>
我有以下指令:
.directive('chat', function() {
return {
restrict: 'E',
templateUrl: '/tpl/chat-box.html'
}
}]);
及以下控制器:
.controller('ChatCtrl', ['$scope', '$pusher',
function($scope, $pusher) {
$scope.pusher = $pusher(client);
}])
我應該在哪裏處理Ajax請求接收的郵件和推通道綁定接收新郵件對於聊天框?在控制器中還是在指令中?