It’s pretty straightforward but not very clear in the documentation, so how do you pass-in arguments in a callback in an Angular component? In your Angular component you have to bind your callback with ‘&’ and return an object with the passed-in name as key: Angular-component.html <my-component callback=”$ctrl.callback(keyName)”></my-component> Angular-template.html <button ng-click=”$ctrl.save({‘foo’:’bar’})”>Pass object to callback</button> Angular-component-and-controller.js […]
Category: javascript

How to download an inline SVG as jpg or png
For a customer i had to build a small drawing app where one of the features was download your drawing. The drawing was an inline SVG and it had to be downloaded as a jpg or png image. Pretty straight forward, right? Here is what I ended up doing: Covert inline SVG to data URI Draw image on canvas Convert […]

How to preload an entire html5 video before play, SOLVED
For a customer I had to implement an experience where depending on the user’s choice parts of a video should play. It should play instantly hence the video had to be fully downloaded before the user was allowed to interact with it. So how do you force a video to preload an entire video? Solution #1, preload attribute (no good) The obvious […]

The lazy loading SEO problem, SOLVED!
The SEO problem TL;DR: – short story: Lazy loaded images won’t be indexed by search bots like googlebot! Long story: The purpose of lazy loading images is to speed up a website’s performance without pushing extra HTTP requests through a full page refresh. The goal is to save bandwidth on visitors who may never scroll down […]

bLazy.js – A lazyload image script
2016.10.25: New release, bLazy version 1.8.2 bLazy is a lightweight script for lazy loading and multi-serving images. It’s written in pure JavaScript why it doesn’t depend on 3rd-party libraries such as jQuery. bLazy works on all modern browsers, including on IE7+. Demo | Download | Examples Contents How to use bLazy Options Selector Offset Container Callbacks, success & error […]

bPopup.js – A jQuery modal popup plugin
01.24.15: New release, bPopup version 0.11.0 01.16.14: Sadly my host has had serious server issues why all old comments are gone! bPopup is a learning and exploring jQuery project. It’s a lightweight cross browser jQuery popup plugin. It’s not creating your popup but doing all the logic as opening, closing, centering on resize & scroll, […]