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

mw-error-messages

v1.2.6

Published

angular wrapper for input validation

Downloads

9

Readme

mw-error-messages

mw-error-messages is an AngularJS module that wrap the ngMessage into a easy to use directive for error validation. It has several features like an icon in the input field or to show that a field is valid and invalid.

Requirements (tested in)

  • Angular (v1.6.6)
  • NgMessages (v1.6.6)
  • Bootstrap (v3.3.7) used as default grid system
  • (Optional) FontAwsome (4.3.0) or another font if you want to use icons
  • (Optional) ui-bootstrap (2.5.0)

Install

You can install this package either with npm or with bower.

npm

npm install mw-error-messages --save

bower

bower install mw-error-messages

Usage

Once the script is included in your html file, simply include the module in your app:

angular.module('myApp', ['ngMessages', 'mw-error-message']);

And use the included 'mwErrorMessage' directive thusly:

<div mw-error-message="CTRLSYSTEM_">
    <input title="" type="text" name="test" ng-model="model.test" class="form-control" required/>
</div>

The content of mw-error-message is used as the label or if you use a translation directive its used as a prefix combined with the name of the input field. In this example the marker would be 'CTRLSYSTEM_TEST'.

If you use the required attribute, a '*' will be placed behind the label to mark this field as required. This also works with ng-required.

Config

Name | Type | Description ----------------------- | --------- | ------------ icon | boolean | Use icons or not icon_template | string | Define the icon template success | boolean | Show success or not label_classes | array | Set label classes div_inner_classes | array | Set inner div classes div_outer_classes | array | Set additional outer div classes help_block_classes | array | Set help block classes additional_help_block | string | Template for addtional help block messages | array | Associative array. Key field are the "when directive" value is the message. translate | boolean | Should the translate filter be used

icon, success and addtional_help_block can be changed in the html like:

<div mw-error-message="CTRLSYSTEM_" mw-error-message-options="mwOptions">
    <input title="" type="text" name="test" ng-model="model.test" required/>
</div>
$scope.mwOptions = {
    icon: true,
    tooltip: true,
    success: true,
    addHelp: '<span>Additional Help block</span>'
};

If you want to use other Font icons just override this:

.has-success .wm_error_message_icon:after{
	content: "\f00c";
}
.has-error .wm_error_message_icon:after{
	content: "\f00d";
}

If you want to use more messages or change the content of the default message:

// override default message
mwConfig.messages['required'] = 'This field is required';
//add a new message
mwConfig.messages['birthday'] = 'You need to be 18 years old.';

Demo

View demo on Plunker

Tasklist

  • [ ] add more examples
  • [ ] add documentation
  • [X] nodejs, bower support
  • [ ] fix spelling, grammar mistakes