![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
angular-ui-router-menus
Advanced tools
angular-ui-router state derived menu, nav, navbar, tab and other navigation tools
angular-ui-router state derived menu, nav, navbar, tab and other navigation tools
Sorry, I should have documented this earlier. Nevermind better late than never.
Bower
bower install --save angular-ui-router-menus
Npm (webpack/systemjs, etc)
npm install --save angular-ui-router-menus
Include in angular app/html, make sure you have angular and ui-router up and working:
<head>
<script src="js/angular-ui-router.min.js"></script>
<script>
var myApp = angular.module('myApp', ['ui.router', 'ui.router.menus']);
</script>
</head>
In ui-router states, simply add a property called menu
(keyword) with value string|any object. menu
object can have any fields of your choice like name
(keyword), content
, priority
, active
, disabled
, tag
(keyword) etc.
$stateProvider
.state('company', {
controller: '...',
template: '...',
menu: {
name: 'company-menu',
active: true,
content: 'Company',
priority: 99,
anything: 'put any property / object'
tag: 'sidebar topmenu'
}
})
.state('company-about', {
menu: 'About',
tag: 'sidebar'
})
.state('investors', {
menu: 'Investors',
tag: 'topmenu'
});
In templates,
<ul menus="menuItems">
<li ng-repeat="menu in menuItems><a ui-sref="{{menu.state.name}}">{{menu.name}}</a></li>
</ul>
Use
menu.state
to access all state properties.
<ul menus="menuItems">
<li ng-repeat="menu in menuItems | orderBy:'-priority'"><a ui-sref="{{menu.state.name}}">{{menu.name}}</a></li>
</ul>
<ul menus="menuItems" include="company*">
<li ng-repeat="menu in menuItems><a ui-sref="{{menu.state.name}}">{{menu.name}}</a></li>
</ul>
<ul menus="menuItems" tag="sidebar">
<li ng-repeat="menu in menuItems><a ui-sref="{{menu.state.name}}">{{menu.name}}</a></li>
</ul>
By default, menu items are flattened. To maintain the tree hierarchy of states and access menu.children
array of sub menus on each menu item:
<ul menus="menuItems" type="tree">
<li ng-repeat="menu in menuItems>
<a ui-sref="{{menu.state.name}}">{{menu.name}}</a>
<ul>
<li ng-repeat="submenu in menu.children>
<a ui-sref="{{submenu.state.name}}">{{submenu.name}}</a>
</li>
</ul>
</li>
</ul>
By default,
type='list'
.
More fun? Use glob patterns and also add multiple include/tags delimited with spaces.
<ul menus="menuItems" include="company* investors">
<li ng-repeat="menu in menuItems><a ui-sref="{{menu.state.name}}">{{menu.name}}</a></li>
</ul>
<ul menus="menuItems" tag="sidebar topmenu">
<li ng-repeat="menu in menuItems><a ui-sref="{{menu.state.name}}">{{menu.name}}</a></li>
</ul>
Deep dive? Inject $menus service into controller and call $menu.get|getTree.
FAQs
angular-ui-router state derived menu, nav, navbar, tab and other navigation tools
The npm package angular-ui-router-menus receives a total of 5 weekly downloads. As such, angular-ui-router-menus popularity was classified as not popular.
We found that angular-ui-router-menus demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.