Skip to content

andrefarzat/ng-error

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ng-error

Angular ngError directive

Install via bower and usage in browser

bower install ng-error --save

Add a <script> to your html

<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/ng-error/ng-error.js"></script>
...
<script>
// add 'ngError' as dependency to your module
var yourModule = angular.module("yourModule", ['ngError']);
</script>

Install via npm and usage with browserify

npm install ng-error --save
// Require it in your module
require('ng-error/ng-error');

// Then use with a angular
var yourModule = angular.module('yourModule', ['ngError']);

Usage

<!-- You can add the `ng-error` directive in `<img>` tags -->
<img src="beautifulImage.jpg" ng-error="someFunction()" alt="" />

If you intend to use it with video/audio:

<video ng-src="{{someUrl}}">
  <source src="dynamicsearch.mp4" type="video/mp4"></source>
  <!-- on the only/last source -->
  <source src="otherdynamicsearch.avi" type="video/avi" ng-error="handleError()"></source>
</video>