imagey-filter

1.0.0 • Public • Published

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.module('myApp', ['imagey'])

In a template

<div>
  <!-- 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 }}
</div>

In Javascript land

// Pull in the filter service
myApp.controller('fooCtrl', function($scope, $filter) {
  // Grab a reference to imagey
  var imagey = $filter('imagey')
 
  // And run it on some text
  $scope.withImages = imagey(plaintext)
})

Readme

Keywords

none

Package Sidebar

Install

npm i imagey-filter

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • 8bitdesigner