Angular ngError directive
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>
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']);
<!-- 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>