angular-quiet-console

1.1.0 • Public • Published

Angular Quiet Console

A simple module for hiding unwanted warnings in the browser console, inspired by Angular Material and this SO question.

Installation

Download it using your preferred method:

Method Command
NPM npm install angular-quiet-console
Bower bower install angular-quiet-console
GitHub git clone https://github.com/sscovil/angular-quiet-console.git

Include it in your index.html file:

<script type="text/javascript" src="/path/to/angular-quiet-console.js"></script>

Add it to your angular module as a dependency:

angular.module('myApp', ['angular-quiet-console']);

Usage

Here is an example that gets rid of an actual Angular Material console warning:

angular.module('myApp', ['angular-quiet-console'])
    .config(quietConsoleConfig);
    
function quietConsoleConfig($quietConsoleProvider) {
    $quietConsoleProvider.ignore(/^The placeholder='.*' will be ignored since this md-input-container has a child label element\.$/);
}

The igonre() function is available at config time via $quietConsoleProvider and at runtime via $quietConsole, and is chainable. It accepts a string or regular expression that will be compared to each console warning message using String.prototype.match() to determine if the warning should be suppressed.

Package Sidebar

Install

npm i angular-quiet-console

Weekly Downloads

2

Version

1.1.0

License

MIT

Last publish

Collaborators

  • sscovil