(function() { 'use strict'; window.app.directive('monthlyInventoryReport', monthlyInventoryReport); function monthlyInventoryReport() { return { scope: { monthlyInventoryData: "=" }, templateUrl: '/report/template/monthlyInventoryReport.tmpl.cshtml', controller: controller, controllerAs: 'vm' } } controller.$inject = ['$scope', '$uibModal', 'inventorySvc']; function controller($scope, $uibModal, inventorySvc) { var vm = this; vm.monthlyInventoryData = $scope.monthlyInventoryData; vm.editInventory = function (inventoryId) { inventorySvc.find(inventoryId) .success(function (inventory) { $uibModal.open({ template: '', scope: angular.extend($scope.$new(true), { inventory: inventory }) }); }); } } })();