问题
Hi All i'm working on Implementing a SignalR Stock Ticker Using AngularJS based on an example over here. But i'm getting an error while connecting to signalr like this TypeError: $.hubConnection is not a function
And this is where the error is showing:
var initializeClient = function () {
//Creating connection and proxy objects
console.log("anil");
connection = $.hubConnection();
//console.log("anil.r");
proxy = connection.createHubProxy('stockTicker');
configureProxyClientFunctions();
start();
};
Since I'm new to working on signalr , have got lots of confusion in it can anybody help me out of this .
回答1:
- npm install -s signalr
Add the next lines to angular-cli.json
"scripts": [ ... "../node_modules/signalr/jquery.signalR.js" ],
回答2:
- Make sure it is added, if your project version Angular 6+ add the next lines to angular.json
Re-compile project.
"scripts": [
...
"node_modules/jquery/dist/jquery.js",
"node_modules/signalr/jquery.signalR.js"
],
来源:https://stackoverflow.com/questions/40890506/signalrs-hubconnection-is-not-a-function