npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ngx-click

v1.0.1

Published

This directive allows you to assign the functionality of receiving the click event when pressing "Enter" after navigating using the tab keys.

Downloads

1

Readme

ngClick Directive

This directive allows you to assign the functionality of receiving the click event when pressing "Enter" after navigating using the tab keys.

Usage

Installation:

First, make sure the ngClick directive is present in your Angular project. You can add it to a module or a standalone component.

Implementation:

Add the ngClick directive to the elements you want to receive the click event when pressing "Enter". Here's an example in your HTML template:

<ul>
  <li tabindex="1" ngClick (click)="handleItemClick()">Item 1</li>
  <li tabindex="2" ngClick (click)="handleItemClick()">Item 2</li>
  <li tabindex="3" ngClick (click)="handleItemClick()">Item 3</li>
</ul>

Make sure to define the handleItemClick() function in your component to execute when "Enter" is pressed on one of the elements.

Functionality:

When one of the elements is focused due to navigation using the tab keys and "Enter" is pressed, the EnterClickDirective will detect the event and, after verifying that the focused element is the same as the one associated with the directive, it will call the click event associated with that element.

Therefore, when you press "Enter" on the focused element, the handleItemClick() function will be executed, allowing you to perform the desired actions.

Ensure to import and declare the directive:

Before using the directive, make sure to import and declare it in the module containing the component where you're using it.

// app.module.ts or the module where you need to use the directive
import { NgModule } from "@angular/core";
import { EnterClickDirective } from "ngx-click";

@NgModule({
  declarations: [
    // ...
    EnterClickDirective,
  ],
  // ...
})
export class AppModule {}

or

import { NgModule } from "@angular/core";
import { EnterClickDirective } from "ngx-click";

@Component({
  selector: "app-root",
  templateUrl: "./app.component.html",
  styleUrls: ["./app.component.scss"],
  standalone: true,
  imports: [EnterClickDirective],
})
export class AppComponent {}

With these steps, you should now be able to assign the functionality of receiving the click event when pressing "Enter" after navigating using the tab keys to the elements you desire in your Angular application.