function getCompiledElement() { $scope.chart = { additional: "$ 1.56 / per minute", text: "phoneCard.voice", total: 250, unit: "MIN", used: 127 }; const mockParentController = { onClick( target ) { selectedChartType = target; } }, parentElement = angular.element('<div><com-cycle-data-chart chart="chart" service-type="voice"></com-cycle-data-chart></div>'); // http://stackoverflow.com/a/19951141 option 4) parentElement.data('$comCardBigController', mockParentController); const compiledDirective = compile(parentElement)($scope).find('com-cycle-data-chart'); $scope.$digest(); return compiledDirective; }