Skip to content

Instantly share code, notes, and snippets.

@ndhoule
Created February 7, 2014 22:24
Show Gist options
  • Save ndhoule/8873279 to your computer and use it in GitHub Desktop.
Save ndhoule/8873279 to your computer and use it in GitHub Desktop.
var floatingButtonDirective = function() {
return {
restrict: 'AE',
scope: {
text: '@'
},
template: '<div class="floating-button">Text: {{ text }}</div>'
};
};
angular.module('App.FloatingButton')
.directive('floatingButton', floatingButtonDirective)
.run([
'$compile',
'$rootElement',
'$rootScope',
function($compile, $rootElement, $rootScope) {
var html = '<floating-button></floating-button>';
var scope = $rootScope.$new();
scope.text = 'test';
$rootElement.append($compile(html)(scope));
}
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment