2017-06-14 73 views
0

//角控制器無法讀取未定義的屬性'notificationsHub'? SignalR與angularJS

$scope.notification = $.connection.notificationsHub; 

$scope.SendNotification = function (schoolId) { 
    $http({ 
     url: "/Notifications/InsertNotification?SchoolId=" + schoolId+"&Notification="+$scope.Notification, 
     method: "GET" 
    }).then(function (res) { 
     console.log(res); 


    notification.client.sendNotification = function() { 
     getAllNotifications(); 
    } 
    $.connection.hub.start().done(function() { 
     getAllNotifications(); 
    }).fail(function (e) { 
     console.log(e); 
     alert(e); 
    }) 

    function getAllNotifications() { 
     $http({ 
      url: "/Notifications/Notifications?SchoolId=" + schoolId, 
      method: "GET" 
     }).then(function (res) { 
      console.log(res); 

     }); 
    } 
    }); 
} 

C#代碼(集線器類)

public void Send() 
{ 
    IHubContext context = GlobalHost.ConnectionManager.GetHubContext<NotificationsHub>(); 
     context.Clients.All.SendNotification(); 
} 

我試圖在owin啓動類添加地圖和所有的腳本被放置在正確的地方,我嘗試了這麼多的解決方案,它不起作用,我需要幫助:D

回答

0

我發現一個解決方案說註釋或從global.cs文件中刪除捆綁軟件註冊並且看起來signalR的文件與bundleconfig.cs文件中的其他.js文件有衝突,並且它解決了

相關問題