
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
A button and contextual menu for Angular 9+.
NgyMenu is a directive binding to on any kind of element.
npm install ngy-menu
Import into your module
...
import { NgyMenuModule } from 'ngy-menu';
...
@NgModule({
...
imports: [
...
NgyMenuModule,
...
],
...
})
export class MyModule { }
In your component :
import { MenuDataInput,Binding } from 'ngy-menu';
...
export class Mycomponent{
...
// menu structure
menuData:MenuDataInput=[
{
label:'vlad'
},
{
label:'children here',
children:[
{label:'suubbb'},
{label:'yo'},
]
},
{
label:'click me',
action:(menu)=>{
alert('hi!');
menu.close();
}
},
];
...
In your template :
...
<div
class="context-menu-target"
[ngyMenu]="menuData"
[ngyMenuBinding]="'context'"
>
<span>Contextual menu here</span>
</div>
<div
class="button-menu-target"
[ngyMenu]="menuData"
[ngyMenuBinding]="'BottomRight'"
>
<span>Button menu here</span>
</div>
...
[ngyMenu] : MenuDataInput The ngy-menu directive.// defines a menu item
type MenuItemData={
label:string;
icon?:string;
action?:Function,
children?:MenuDataInput;
data?:any;
};
// defines or generates a menu item
type MenuItemDataInput=(dat?:any)=>MenuItemData|MenuItemData;
// defines a menu list
type MenuData=MenuItemDataInput[];
// defines or generates a menu lista menu list
type MenuDataInput=(dat?:any)=>MenuData|MenuData;
[ngyMenuBinding] : 'context'|'TopLeft'|'TopRight'|'LeftTop'|'RightTop'|'LeftBottom'|'RightBottom'|'BottomLeft'|'BottomRight' (default='RightBottom')'context' : binds a context menu'Top'|'Bottom'|'Left'|'Right' they indicates respectively the button side and in witch direction the menu will overlay.
TopLeft RightBottom
┌──────────────┐ ┌─────────┬──────────────┐
│ Menu │ │ Buttom → Menu │
├──────────────┤ └─────────┼↓─────────────┤
│ Menu ← │ │ Menu │
└────┬───────↑─┤ └──────────────┘
│ Buttom │
└─────────┘
[ngyMenuCellTemplate] : TemplateRef<any> MenuItem renderer
Overrides the default menu item.
[ngyMenuOptions]:
listClass : string overrides the default menu list css classautoClose : boolean Automaticly close the menu when clicking a leaf element.on : Record<MenuEvents,Function> callbacks for menu events.binding : 'TopLeft'|'TopRight'|'LeftTop'|'RightTop'|'LeftBottom'|'RightBottom'|'BottomLeft'|'BottomRight' specify 2nd level orientation.More exhaustive exemple of settings :
In your component :
...
menuData=[
{
label:'label 1'
},
{
label:'some children',
children:[
{
label:'vlad'
},
{
label:'sub children',
children:[
{label:'suubbb'},
{label:'yo'},
]
},
{
label:'click me',
action:(menu)=>{
alert('hi!');
menu.close();
}
},
]
},
()=>({
label:'random children',
children:()=>(Array(Math.ceil(Math.random()*10)).fill('').map((v,i)=>({
label:'element '+i,
action:(menu)=>{
alert('You clicked element '+i);
menu.close();
}
})))
}),
];
menuOptions={
// autoClose:true,
listClass:'my-menu-list',
on:{
'click':((mio)=>alert('clicked'+mio.itemData.label))
}
};
...
In your template :
<div
class="context-menu-target"
[ngyMenu]="menuData"
[ngyMenuBinding]="'context'"
[ngyMenuCellTemplate]="cellTemplate"
[ngyMenuOptions]="menuOptions"
>
<span>Contextual menu here</span>
</div>
<ng-template
#cellTemplate
let-icon="icon"
let-label="label"
let-childrenCount="childrenCount"
let-data="data"
>
<div class="my-menu-item">
<span *ngIf="icon" class="ngy-menu-icon" [innerHTML]="icon"></span>
<span class="ngy-menu-label">{{label}}</span>
<span *ngIf="childrenCount" class="ngy-menu-expander">▶</span>
</div>
</ng-template>
FAQs
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
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.