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

@theo4u/ng-alert

v2.1.0

Published

[![Travis](https://img.shields.io/travis/theo4u/ngAlert.svg)](https://travis-ci.org/theo4u/ngAlert) [![npm](https://img.shields.io/npm/v/@theo4u/ng-alert.svg)](https://www.npmjs.com/package/@theo4u/ng-alert) [![semantic-release](https://img.shields.io/bad

Downloads

40

Readme

NgAlert

Travis npm semantic-release

This is a simple alert component, to help show different level of alerts and easy configurations on how you want it to act. Also, supports confirmation alert. Oh yea! easy to style to follow your own feel.

Error Message Info Message Warning Message Success  Message Confirm  Message

Installation

npm install --save @theo4u/ng-alert

For Angular 5 and below use

npm install --save @theo4u/[email protected]

Then open open up your styles.css and add this line (for easy customization, don't forget to send a PR for nice UIs, so other peeps can use it :winks:)

@import "../node_modules/@theo4u/ng-alert/style.css";

Update your app.module.ts imports array

import { NgAlertModule } from '@theo4u/ng-alert';
...
imports: [
    BrowserModule,
    NgAlertModule,
    ....
  ]

Demo

HERE

Usage

<ng-alert [(message)]="message" [dismissable]="true"></ng-alert>
  • message: is a two bounded attribute which takes in IMessage
          export interface IMessage {
          type: MessageType,
          message: string,
          title?: string,
          buttons?: Array<{
            label: string,
            action?: Function,
            css?: string
          }>
          } 
    type can be MessageType.info, MessageType.success, MessageType.error or MessageType.warning
  • dismissable: is an optional field to allow users to close the alert or not. boolean. Defaults to
  • closeType: is used to determine which type of close button should be place on it, and only accepts CloseType enum. Defaults to CloseType.TIMES
    export enum CloseType {
    TIMES, NORMAL
    }

// usage
// NORMAL -> the close button is beneath the alert message
// TIMES -> the close button is by the far right with x
<ng-alert [(message)]="message" [dismissable]="true" [closeType]="closeTypes.NORMAL"></ng-alert>

App Level Alert

You can decide to make use of the NgAlertService to push new messages, useful if you want to maintain a central point of alerting your users of anything, like at the top of your page.

  ngOnInit() { // this should be place in the location where you the ngAlert component markup is called
    this._alertSub = this._ngAlert.getSource().subscribe(message => {
      this.message = message;
    })
  }

From any location withing your app, just push the new messages with NgAlertService.push(IMessage); after adding it to your constructor.

NB: any of the following above can be imported like below

import { NgAlertService, IMessage, MessageType, CloseType  } from '@theo4u/ng-alert';

Confirmation Alert

It can also serve as a confirmation alert, if buttons properties of IMessage is passed in, which is an array

  • label: the text to show for your button
  • action: the action to perform when the button is clicked
  • css: your custom css to pass in, since its just a plain <button></button>

Example Usage

Check app.component.ts

Contribution

Check CONTRIBUTING.md. npm start instead of ng serve so you easily watch for scss changes while playing with the scss files. Makes use of

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI README.