1.1.2 • Published 7 years ago

@vendasta/fec-menu v1.1.2

Weekly downloads
1
License
ISC
Repository
-
Last release
7 years ago

menu

Requirements

When using the menu component in your app:

  • add @vendasta/fec-menu to the dependencies of your app
  • add MenuModule to the import list in angular module

Usage

  • add <va-menu></va-menu> to the template of the parent component
InputDescription
menuItemsJSON list of objects for menu item arguments
activeMenuIdwhich menu item should be marked as the currently visited location
urlURL to request JSON data of menuItems (instead of using menuItems)
autoCloseThe menu will automatically close when user click somewhere other than this menu area

No default menu items will be populated. Specify menu items via the menuItems input.

Example menuItems JSON data

[
    {
        label: 'menu item with no URL',
        menuId: 'no-url-do-something',
        ngRoute: false
    },
    {
        label: 'WTF is “nyancat”?',
        menuId: 'go-to-lmgtfy',
        url: 'lmgtfy.com/?q=nyancat',
        ngRoute: false
    },
    {
        label: 'Route managed by Angular Router',
        menuId: 'angular-route',
        url: '/angular-app',
        ngRoute: true
    }
]

Example output

<va-menu [activeMenuId]="activeMenuId" [url]="apiUrl" [menuItems]="[ {label: 'menu item with no URL', menuId: 'no-url-do-something', ngRoute: false}, {label: 'WTF is “nyancat”?', menuId: 'go-to-lmgtfy', url: 'lmgtfy.com/?q=nyancat', ngRoute: false}]" (menuItemClickEvent)="onMenuItemClick($event);" [autoClose]="true"></va-menu>

emample menu rendering

menu-item

Chiefly used by menu. Generates <li> elements, so must be used within a <ul> or <ol>.

Component inputs

InputDescription
menuItemMenuItem object
activeMenuIdstring

MenuItem object

FieldDescription
urloptional Read by MenuItemComponent when handling clicks
labelText displayed
menuIdstring defining the unique identity within the app
iconoptional class name for CSS applied icon, on the left
nestedItemsoptional list of MenuItem objects for a sub menu
expandedboolean for sub menu, if it exists — sets whether sub menu is expanded when menu initially renders
rightIconoptional class name for another icon, on the right; overrides sub menu icon, if it exists
ngRouteIndicate this route is managed by angular router or not

Example

<va-menu-item [activeMenuId]="activeMenuId" [menuItem]="subMenuItem" (expandEvent)="expandAction($event)" (menuItemClickEvent)="onMenuItemClick($event);"></va-menu-item>

example menu item rendering

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.4.0

8 years ago

0.3.2

8 years ago

0.3.1

8 years ago

0.3.0

8 years ago

0.2.0

8 years ago

0.1.2

8 years ago

0.1.0

8 years ago

0.0.13

8 years ago

0.0.12

8 years ago

0.0.11

8 years ago

0.0.10

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago

0.0.0

8 years ago