Skip to content

Instantly share code, notes, and snippets.

@staticnull
Last active August 29, 2015 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save staticnull/1dd2c1ad11fcb8382a9c to your computer and use it in GitHub Desktop.
Save staticnull/1dd2c1ad11fcb8382a9c to your computer and use it in GitHub Desktop.
Report Demo - HTML Button + Controller
<!-- On an HTML page before the report -->
<button class="btn btn-success" ng-click="generateReport()"><span class="fa fa-file-pdf-o"></span> Generate Report</button>
<!-- demo.coffee -->
'use strict'
angular.module('demo').controller 'DemoCtrl', ($scope, $stateParams, $state, $q, $window, ReportService, profile, evaluation, group) ->
...
# Report
$scope.generateReport = () ->
# Returns stringified url
url = ReportService.reportUrl($stateParams.profileId, $stateParams.evaluationId, $stateParams.groupId, 'reportName')
$window.open(url)
# https://github.com/angular/angular.js/issues/4853
return true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment