Skip to content

Instantly share code, notes, and snippets.

@mgcrea
Created August 30, 2012 17:05
Show Gist options
  • Save mgcrea/3533482 to your computer and use it in GitHub Desktop.
Save mgcrea/3533482 to your computer and use it in GitHub Desktop.
.directive('uiPopover', ['$compile', '$http', function($compile, $http) {
return {
restrict: 'A',
scope: {
hide: '&hide' // did not understand what is this
},
link: function postLink(scope, element, attr, ctrl) {
console.warn('postLink', arguments, this);
// scope is the anchor scope
scope.hide = function() {
console.log('in');
element.popover('hide');
}
$http.get(attr.uiPopover).success(function(data) {
element.popover({
content: $compile(data)(scope), // popover content will get a new scope that I need to put hide() on.
html: true
});
});
}
}
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment