angularIO.directive('biocard', function($rootScope, $timeout, $mdDialog) { return { restrict: 'A', scope: {}, link: function(scope, element, attrs) { // SET SCOPE VALUES scope.name = attrs.name; scope.pic = attrs.pic; scope.bio = attrs.bio; scope.twitter = attrs.twitter; scope.website = attrs.website; // CLOSE MODAL METHOD scope.closeDialog = function() { $mdDialog.hide(); }; // OPEN BIO WHEN CLICKING ON CARD element.on('click', function($event) { $mdDialog.show({ parent: angular.element(document.body), targetEvent: $event, scope: scope.$new(), // Uses prototypal inheritance to gain access to parent scope preserveScope: true, template: '' + ' ' + ' ' + '

{{name}}

' + ' ' + '

{{bio}}

' + '
' + '
' + ' ' + ' Close Bio' + ' ' + '
' + '
' }); }); } }; });