尝试在 pubnub-angular 中调用函数时得到 "Missing Callback"

Getting a "Missing Callback" when trying to call functions in pubnub-angular

我正在尝试使用 PubNub 和 pubnub-angular 获得一个简单的聊天应用程序 运行。当我尝试调用 Pubnub.subscribe() 时,出现 Missing Callback 错误,参考 pubnub.min.js.

中的第 1 行

东西出现要设置好:

app.js:

angular
.module('pnChatApp', [
    'ngResource',
    'ngRoute',
    'pubnub.angular.service'
])
.config(function($routeProvider) {
    $routeProvider
        .when('/main', {
            templateUrl: 'views/main.html',
            controller: 'MainCtrl',
        })
        .when('/join', {
            templateUrl: 'views/join.html',
            controller: 'JoinCtrl',
        })
        .otherwise({
            redirectTo: '/join'
        });
});

main.js:

   angular.module('pnChatApp')
    .controller('MainCtrl', ['$scope', '$rootScope', '$location', 'Pubnub', function($scope, $rootScope, $location, Pubnub) {
    ...
    Pubnub.subscribe({
     channel: $scope.controlChannel,
    });

并且,index.html:

<script src="https://cdn.pubnub.com/pubnub.min.js"></script>
<!-- build:js(.) scripts/vendor.js -->
<!-- bower:js -->
<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/bootstrap/dist/js/bootstrap.js"></script>
<script src="bower_components/angular-resource/angular-resource.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script>
<script src="bower_components/pubnub-angular/dist/pubnub-angular.min.js"></script>

PubNub 在另一个控制器中初始化,这发生在我到达这一点之前。

有什么想法吗?

订阅时需要注册回调:

Pubnub.subscribe({
  channel: $scope.controlChannel,
  callback: function (message) {
    console.log(message);
  }
});