Skip to content

Instantly share code, notes, and snippets.

@aregee
Created June 28, 2015 07:18
Show Gist options
  • Save aregee/7fa5d3b45b226e22c473 to your computer and use it in GitHub Desktop.
Save aregee/7fa5d3b45b226e22c473 to your computer and use it in GitHub Desktop.
/*
* Calaca - Search UI for Elasticsearch
* https://github.com/romansanchez/Calaca
* http://romansanchez.me
* @rooomansanchez
*
* v1.2.0
* MIT License
*/
/* Calaca Directive
*
* <dynamic-element message='htmlString'></dynamic-element>
*
*/
Calaca.directive('dynamicElement', ['$compile', function ($compile) {
return {
restrict: 'E',
scope: {
message: "="
},
replace: true,
link: function(scope, element, attrs) {
var template = $compile(scope.message)(scope);
element.replaceWith(template);
},
controller: ['$scope', function($scope) {
$scope.clickMe = function(){
alert("hi")
};
}]
}
}]);
@aregee
Copy link
Author

aregee commented Jun 28, 2015

No Results

{{result.title}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment