Skip to content

app-sidebar-nav navItems reassignment #126

Closed
@nealyip

Description

@nealyip
export class DefaultLayoutComponent implements OnDestroy, OnInit {
       ngOnInit(): void {
        this.navItems = navItems;
        setTimeout(() => {
            this.navItems = [{
                name: 'a',
                url: 'b'
            }];
        }, 3000);
    }
}

For the above code, the component will prepend an item instead of replacement.
Is this behavior intended or a bugs?

For semantic meaning, reassigning variables seems to be referring to replacement instead of prepend.

Thanks

Activity

emilynielson

emilynielson commented on Dec 26, 2018

@emilynielson

I'm having the same issue. Is there a way to reassign it and get the navbar to only show the reassignment?

self-assigned this
on Feb 13, 2019
added a commit that references this issue on Feb 15, 2019
xidedix

xidedix commented on Feb 15, 2019

@xidedix
Member

@nealyip @emilynielson
please update @coreui/angular dependency to 2.4.1
and let us know if this helps

pranavs1791

pranavs1791 commented on Mar 29, 2019

@pranavs1791

Hi i updated @coreui/angular to @2.4.5 . But still the issue persists. I can't reassign the navItems . The value i change in my .ts file doesn't get affected in my template file.

xidedix

xidedix commented on Mar 29, 2019

@xidedix
Member

hi @pranavs1791

Please try to use this code example for quick and dirty verification whether dynamic reassign of sidebar items works or not.

What you need is to create some sort of sidebar-nav.service to reassign navItems array on the fly and subscribe the result in default-layout.component

github-actions

github-actions commented on May 16, 2022

@github-actions

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    app-sidebar-nav navItems reassignment · Issue #126 · coreui/coreui-free-angular-admin-template