This repository has been archived by the owner on Mar 31, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[kbnTopNav] break out controller, allow implementors to pass it in
The first iteration of `kbnTopNav` prevented the need to define a `configTemplate` and the `menuItems` in separate locations, but moved the external API to a `kbnTopNav` object that was exposed on the scope where `kbnTopNav` was rendered. This meant that in order to programmatically control the `kbnTopNav` other directives needed to share a scope with it, or inherit from its scope. Additionally, since the `kbnTopNav` object is potentially not available when other directives boot, all access to this object needed to be wrapped in a call to `$timeout`. In order to prevent this, but keep the nice API of `kbnTopNav`, this change breaks the controller and it's API out of `kbnTopNav` and exposes it via a Private module. Now, implementors can instantiate the `KbnTopNavController` themselves and pass it into the `<kbn-top-nav>` directive via the config attribute. This allows implementors to store the topNav API wherever makes sense in their implementation. When the config attribute is not already an instance of the `KbnTopNavController` the directive will create an instance out of the passed value, which means that no existing implementations need to change at all.
- Loading branch information