Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app-sidebar-nav navItems reassignment #126

Closed
nealyip opened this issue Dec 9, 2018 · 5 comments
Closed

app-sidebar-nav navItems reassignment #126

nealyip opened this issue Dec 9, 2018 · 5 comments
Assignees

Comments

@nealyip
Copy link

nealyip commented Dec 9, 2018

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

@emilynielson
Copy link

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

@xidedix xidedix self-assigned this Feb 13, 2019
xidedix added a commit to coreui/coreui-angular that referenced this issue Feb 15, 2019
- fix(sidebar): navItems reassignment bug [#126](coreui/coreui-free-angular-admin-template#126), [#42](coreui/coreui-free-angular-admin-template#42), #12
- refactor(aside): drop `Replace`
- refactor(breadcrumb): drop `Replace` new component `cui-breadcrumb` (migration needed)
- refactor(footer): minor changes
- refactor(header): drop `Replace`
- refactor(layout): cleanup
- refactor(sidebar-nav): drop `Replace`, redesign
@xidedix
Copy link
Member

xidedix commented Feb 15, 2019

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

@xidedix xidedix mentioned this issue Feb 18, 2019
@pranavs1791
Copy link

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
Copy link
Member

xidedix commented Mar 29, 2019

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
Copy link

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
Projects
None yet
Development

No branches or pull requests

4 participants