Как получить доступ к угловой JS $ rootcope в приложении Java весной - PullRequest
0 голосов
/ 26 сентября 2018
$rootScope.loadAccountSubjects = function() {
    if($rootScope.shaAccountId == undefined || $rootScope.shaAccountId == null) {
        $rootScope.shaAccountId  = $("#userInfo_userAccountId").val();
    }
    //console.log("in MenuController");
    WidgetInfoService.getLandingPageByWidgetId({widgetId: $rootScope.widgetId}, function(response) { 
        var data = response.data;
        if(data != null) {
            $rootScope.institutionalPDAllowedStatus = data.allowInstitutionalPD;
            $rootScope.isProxyEnable = data.isProxyEnabled;
            $rootScope.isProxyRequestHealthDoc = data.canRequestHealthDoc;
            $rootScope.canAccessPrivacyPreferences = data.canAccessPrivacyPreferences;
            $rootScope.isPrivacySettingBannerSet = data.isPrivacySettingBannerSet;
            $rootScope.isContactBannerSet = data.isContactBannerSet;
            $rootScope.portalName = data.landingPageName; 
            $rootScope.portalNickName = data.nickName; 
            $scope.portalDateCreated = data.dateCreated;
            $rootScope.pinRequired = data.pinRequired;

            $rootScope.updatePrivacyPrefrences = data.updatePrivacyPrefrences;


            /*for show-hide header*/
            $rootScope.mydata = data.mydata;
            $rootScope.documents = data.documents;
            /*for show-hide header*/



            $rootScope.setting_groups["1"] = "1_"+$rootScope.portalName;
            $scope.lastUpdatedPreferenceDate = data.lastDateUpdatedForPreferences;
            $scope.lastUpdatedAuthorizeAccountDate = data.lastDateUpdatedAuthorizeAccount;
            $scope.lastUpdatedHealthDocumentDate = data.lastDateUpdatedHealthDocuments;

            if(data.isMaleProfileImage && data.maleProfileImageName != null) {
                $rootScope.defaultMaleProfileImage = $rootScope.amazonawsImgContextPath + "profileImage/" + data.maleProfileImageName; 
            }

            if(data.isFemaleProfileImage && data.femaleProfileImageName != null) {
                $rootScope.defaultFemaleProfileImage = $rootScope.amazonawsImgContextPath + "profileImage/" + data.femaleProfileImageName; 
            }

        }
    });
};

я хочу использовать $ rootScope.mydata = data.mydata;$ rootScope.documents = data.documents;эти две переменные на странице jsp в нг-если как я могу использовать его

<li id="mydata_id" class="link"  onclick="changecolor('2')" ng-click="pleaseLoadViewAnswer();"><a href="javascript:;" data-toggle="collapse" data-target=".navbar-collapse.in"><i class="fa fa-database"  ng-if="mydata"></i><span>My Data</span></a></li>

я хочу использовать $ rootScope.mydata = data.mydata;$ rootScope.documents = data.documents;это в приведенном выше HTML-файле

...