Created
November 4, 2013 14:25
-
-
Save jakobloekke/7303217 to your computer and use it in GitHub Desktop.
Revisions
-
jakobloekke created this gist
Nov 4, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ app.filter('sprintf', function() { function parse(str) { var args = [].slice.call(arguments, 1), i = 0; return str.replace(/%s/g, function() { return args[i++]; }); } return function(str) { return parse(str, arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]); }; }); // Usage: $filter('sprintf')( "Hello %s. It's %s to see you!", "World", "very" );