Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "fawad29"

@musa.demir I have emailed the related code, now.

Hi, Is there any update?

Hi,

The menu is loaded fine as per my previous comment, however, sometimes I need to progammatically refresh menu so that it gets the latest data from the server. What is the best way to refresh the menu?

I tried to use events for this purpose but when event is triggered, my global function inside side-bar-menu.component.ts is not available inside the trigged code so I can't simply use the code below.

loadMyMenu(myParameterForMenuSelection: number): void {
//Code here for getting the menu from the server.
 }
reloadMenu(): void {        
        abp.event.on('myParameterForMenuSelectionChanged', function (myParameterForMenuSelection) {
            console.log("EVENT IS FIRED");
            console.log(myParameterForMenuSelection);
            this.loadMyMenu(myParameterForMenuSelection);//I get error here that loadMyMenu is not a function

        });
    }

I receive the below error when event is fired.

ERROR TypeError: this.loadMyMenu is not a function

What is the best way to refresh the menu?

I have fixed this issue, thanks to @musa.demir for asking me to use *ngIf. I am showing my implementation below so that it may help someone else if they get stuck.

In side-bar-menu.component.html add *ngIf="menu", note capital I of If.

<!-- BEGIN: Aside Menu -->
<div [class]="'aside-menu-wrapper aside-menu-' + currentTheme.baseSettings.menu.asideSkin" id="kt_aside_menu_wrapper" *ngIf="menu">
    <div #asideMenu ktMenu [options]="menuOptions" [perfectScrollbar]="{wheelPropagation: false}"
        [ngStyle]="{'max-height': '90vh', 'position': 'relative'}" id="kt_aside_menu" class="aside-menu scroll"
        [attr.data-menu-vertical]="1" [attr.data-menu-scroll]="ui.getIsMenuScrollable() ? 1 : 0"
        [attr.data-menu-dropdown]="ui.isSubmenuToggleDropdown() ? 1 : 0" (mouseenter)="mouseEnter($event)"
        (mouseleave)="mouseLeave($event)" [class]="ui.getLeftAsideClass()">
        <ul class="menu-nav">
            <li  class="menu-item mb-5" aria-haspopup="true"
                data-ktmenu-submenu-toggle="hover" *ngIf="currentTheme.baseSettings.menu.searchActive">
                <menu-search-bar></menu-search-bar>
            </li>
            <ng-container [ngTemplateOutlet]="menuListTemplate"></ng-container>
        </ul>
    </div>
</div>
<!-- END: Aside Menu -->

Replaced this.menu = this._appNavigationService.getMenu(); in ngOnInit() of side-bar-menu.component.ts with the code shown below. Replace your service and method names. Also, don't forget to inject your service in the constructor of side-bar-menu.component.ts

this._myMenuService.getAllGrantedMenus(1, 1, 2)
            .subscribe(result => {
                console.log(result);                
                this.menu = result;                                
            });

Just an update, I was using ngif instead of ngIf (note capital I), after changing it to capital I, I don't receive error but menu is still not displayed, even though it contains the data. I don't know if menu is displayed this way after ngOnInit, there may be a different way of re-rendering i.e calling some method etc. I am not be sure though, can you think of anything else, as it seems like a common functionality?

@musa.demir Thank you for your reply.

When I add *ngif="menu", I received the below error.

`

<div [class]="'aside-menu-wrapper aside-menu-' + currentTheme.baseSettings.menu.asideSkin" id="kt_aside_menu_wrapper" *ngif="menu"> 
    <div #asideMenu ktMenu [options]="menuOptions" [perfectScrollbar]="{wheelPropagation: false}"
         [ngStyle]="{'max-height': '90vh', 'position': 'relative'}" id="kt_aside_menu" class="aside-menu scroll"
         [attr.data-menu-vertical]="1" [attr.data-menu-scroll]="ui.getIsMenuScrollable() ? 1 : 0"
         [attr.data-menu-dropdown]="ui.isSubmenuToggleDropdown() ? 1 : 0" (mouseenter)="mouseEnter($event)"
         (mouseleave)="mouseLeave($event)" [class]="ui.getLeftAsideClass()">
        <ul class="menu-nav">
            <li class="menu-item mb-5" aria-haspopup="true"
                data-ktmenu-submenu-toggle="hover" *ngIf="currentTheme.baseSettings.menu.searchActive">
                <menu-search-bar></menu-search-bar>
            </li>
            <ng-container [ngTemplateOutlet]="menuListTemplate"></ng-container>
        </ul>
    </div>
</div>

<!-- END: Aside Menu -->`

Yes, this.menu contains data when event is fired, please see below the console output.

There must be a way of re-rendering menu.

Thank you

@ismcagdas, are there any built-in methods in ASPNETZero that you use for using LocalStorageService?

I upgraded to the latest node version 14.15.1 and the error has disappeared.

Could you still confirm the correct way for changing port number (in case I am overdoing the changes) as I am sharing a remote desktop environment with a colleague and we both needs to run the system at the same time so we can't use the same port?

Thanks, works fine now.

Showing 11 to 20 of 57 entries