Created
July 17, 2013 07:30
-
-
Save klaascuvelier/6018424 to your computer and use it in GitHub Desktop.
This file contains 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 characters
/** | |
* Inject urls into the url service | |
*/ | |
Module.directive('url', ['$url', function injectUrlData($url) { | |
return { | |
restrict : 'A', | |
compile: function() { | |
return { | |
pre: function(scope, element, attrs) { | |
var lines = element[0].innerHTML.split(';'); | |
angular.forEach(lines, function (line, index) { | |
var data = line.split('='), | |
key, val; | |
if (data.length === 2) { | |
key = $.trim(data[0]); | |
val = $.trim(data[1]); | |
$url.set(key, val); | |
} | |
}); | |
} | |
}; | |
} | |
}; | |
}]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment