Hello all,
  When a user first enters my app, they are automatically logged in, at 
this time the user json object is populated when then fires a 
 $rootScope.$broadcast("UserInfoSynched") message.  At this time, the home 
page starts to paint.
I built a very simple dynamic directive that based on the type displays a 
different panel display:

app.directive("panelDisplay", function ($rootScope, $compile) {
    return {
        restrict: 'E',
        templateUrl: function(elem, attr){
            return "/Content/views/partial/"+ attr.type + "Display.html";
        }
    };
});

Each panel display has it's own controller.  Within that controller, I 
would like the broadcast "UserInfoSynched" message caught, which would then 
paint the panel with the correct user info.  The panel is displayed 
correctly, but it never goes into my $rootScope.$on("UserInfoSynched", 
....) area to fire the call to get the user information needed.

Here is one of the partial panel controllers:
appCtrls.controller('MyItemsController', ['$rootScope', '$scope', 
'$filter', 'NotifyService', 'SessionService','UtilityService',
    function ($rootScope, $scope, $filter, notify, session, utils) {
        var _my_product_list = [];
        var _scrnType = utils.screenType();
        var _isLoaded = false;
        
        $scope.MyProducts = function () {
            return _my_product_list;
        };

        //Events

        //If the window is resized to a larger size and it hasn't been 
loaded yet, then load the items
        $(window).on("resize", function () {
            if (!_isLoaded && _scrnType == utils.screenSize.Desktop || 
_scrnType == utils.screenSize.lgDesktop) {
                _getMyItemsForSale();
                $scope.$apply();
            }
        });


        //Catch the UserInfoSynched event
        $rootScope.$on('UserInfoSynched', function (e, obj) {
            $timeout(function () {
                if (_scrnType == utils.screenSize.Desktop || _scrnType == 
utils.screenSize.lgDesktop) {
                    //Get the items the user has put up for sal
                    _getMyItemsForSale();
                    _isLoaded = true;
                }
            });
        });

        //Catch the OnProductsUpdated event
        $rootScope.$on('OnProductsUpdated', function (e, obj) {
            $timeout(function () {
                if (_scrnType == utils.screenSize.Desktop || _scrnType == 
utils.screenSize.lgDesktop) {
                    //Get the items the user has put up for sal
                    _getMyItemsForSale();
                    _isLoaded = true;
                }
            });
        });



        //***************************************************
        //* Method to synch the product listing when needed *
        //***************************************************
        function _getMyItemsForSale() {

            //Code in here would get all the items for the user
            
        }
    }
]);

Thanks very much!

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to