angularIO.directive('biocard', function($rootScope, $timeout, $mdDialog) { return { restrict: 'A', scope: {}, link: function (scope, element, attrs) { scope.name = element.attr('data-name'); scope.bio = element.attr('data-bio'); scope.pic = element.attr('data-pic'); scope.twitter = element.attr('data-twitter'); scope.website = element.attr('data-website'); scope.$twitter = scope.twitter !== 'undefined' ? 'Twitter' : ''; scope.$website = scope.website !== 'undefined' ? 'Website' : ''; element.on('click', function($event) { $mdDialog.show({ parent: angular.element(document.body), targetEvent: $event, template: '' + ' ' + ' ' + '

' + scope.name + '

' + ' ' + '

' + scope.bio + '

' + '
' + '
' + ' ' + ' Close Bio' + ' ' + '
' + '
', locals: { items: scope.items }, controller: DialogController }); }); function DialogController(scope, $mdDialog, items) { scope.items = items; scope.closeDialog = function() { $mdDialog.hide(); }; } } }; });