New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ngx-func-pipe

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngx-func-pipe

NgxFuncPipe is a simple and lightweight Angular pipe that allows you to call a function directly from your Angular templates. This utility is particularly useful when you need to invoke a function with arguments in your Angular templates.

  • 0.0.3
  • latest
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

NgxFuncPipe

NgxFuncPipe is a simple and lightweight Angular pipe that allows you to call a function directly from your Angular templates. This utility is particularly useful when you need to invoke a function with arguments in your Angular templates.

Installation

You can install this library using npm or yarn: npm install ngx-func-pipe yarn add ngx-func-pipe

Type-safe Template Usage

Since Angular's templates are now type-safe, the function and its argument types will be reflected in the template, giving you full IntelliSense support:

import { Component } from '@angular/core';
import { NgxFuncPipe } from 'ngx-func-pipe';

@Component({
  selector: 'app-math',
  template: `
    <div>
      <!-- The type of foo and bar will be reflected in the template -->
      <p>Sum: {{ foo | ngxFunc: 5: 10 }}</p>
      @if ((bar | ngxFunc: 'str': 1); as result) {
        {{ result }}
      }
    </div>
  `,
  standalone: true,
  imports: [NgxFuncPipe]
})
export class MathComponent {
  foo(arg1: number, arg2: number): number {
    return arg1 + arg2;
  }

  bar(arg1: string, arg2: number): boolean {
    return arg1 && arg2;
  }
}

Features

  • Standalone Pipe: The NgxFuncPipe is a standalone Angular pipe, meaning it can be used without being declared in an Angular module.
  • Function Invocation in Templates: It allows you to invoke a function directly from your Angular templates with the required arguments.
  • Type-safe Templates: Full support for Angular's type-safe templates, ensuring that function types and arguments are reflected in the template.
  • Pure Pipe: The pipe is pure, meaning it only re-evaluates when its input values change, providing performance benefits.

FAQs

Package last updated on 26 Aug 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc