1.1.0 • Published 9 years ago

angular-quiet-console v1.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

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:

MethodCommand
NPMnpm install angular-quiet-console
Bowerbower install angular-quiet-console
GitHubgit 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.