Set correctly SignalR-hub configuration with AngularJS

Viewed 247

I following this tutorial to implement push notifications with SignalR and toastr

before implement it my app.js is like:

  (function () {
        'use strict';

    var app = angular.module('myPortal', ['common.core', 'common.ui'])
        .config(config)
        .run(run);

    /* Setup global settings */
    app.factory('settings', ['$rootScope', function ($rootScope) {
        // supported languages
        var settings = {....

when I update it as tutorial I have something like this:

(function () {
        'use strict';

    var app = angular.module('myPortal', ['common.core', 'common.ui'])
        .config(config)
        .run(run);

    $(function () {
        $.connection.hub.logging = true;
        $.connection.hub.start();
    });


    $.connection.hub.error(function (err) {
        console.log('An error occurred: ' + err);
    });

    angular.module('app')
       .value('notification', $.connection.notification)
       .value('toastr', toastr);


    /* Setup global settings */
    app.factory('settings', ['$rootScope', function ($rootScope) {
        // supported languages
        var settings = {...

but now my app crash and chrome console throw these issues:

angular.js:68 Uncaught Error: [$injector:nomod] Module 'app' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.

and

Uncaught Error: [$injector:unpr] Unknown provider: settingsProvider <- settings

What am I doing wrong? Regards

0 Answers
Related