marmelab / ng-admin

Add an AngularJS admin GUI to any RESTful API
http://ng-admin-book.marmelab.com/
MIT License
3.95k stars 725 forks source link

Cannot decorate template of maMenuBarDirective #1329

Closed Phocea closed 7 years ago

Phocea commented 7 years ago

Description

I am simply trying to provide a new template to the menuBarDirective. However it is never used

myApp.config(function(NgAdminConfigurationProvider, $provide) {

        $provide.decorator('maMenuBarDirective', ['$delegate', function ($delegate) {

            $delegate[0].template = '<div class="navbar-default sidebar" role="navigation">TEST</div>';
            console.log($delegate);
            return $delegate;
        }]);
});

Steps to Reproduce

Execute http://plnkr.co/edit/fVCo93?p=preview

Expected behavior: The menu should display TEST, as per the decorator template

Actual behavior: The default menu template is still used

Phocea commented 7 years ago

Current workaround is to decorate the whole link method of the menuBarDirective. We have to decide if this is acceptable or if the directive should be refactored to ease templating

fzaninotto commented 7 years ago

Normally, you can use template() on the topmost menu, so for the general case, it's already possible. You probably need more than that, and in this case it's not supported.