What is this?
imagey
is an Angular filter that replaces links to images in text, with <img>
tags, similar to how Angular's linky filter
replaces links in text with <a>
tags.
Basically, it turns this:
Check out this awesome google logo: https://www.google.com/images/srpr/logo11w.png
into this:
Check out this awesome google logo: <img src="https://www.google.com/images/srpr/logo11w.png">
How do I get this awesome code?
Use Bower, and, inside your project run bower install --save imagey-filter
.
Okay, now what?
Add it to your Angular dependencies:
var myApp = angular
In a template
<!-- To just turn image links into image tags -->{{ myContent | imagey }}<!-- To turn links into anchor tags, and image links into image tags -->{{ myContent | linky | imagey }}
In Javascript land
// Pull in the filter servicemyApp