Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
mw-error-messages
Advanced tools
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.
You can install this package either with npm
or with bower
.
npm install mw-error-messages --save
bower install mw-error-messages
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.
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.';
FAQs
angular wrapper for input validation
We found that mw-error-messages demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.