angular.module('app') .controller('articlesViewController', ['$scope', '$stateParams', '$mdDialog', 'articlesBusiness', 'luBusyBusiness', 'AppUtilsBusiness', function($scope, $stateParams, $mdDialog, articlesBusiness, luBusyBusiness, AppUtilsBusiness) { $scope.busy = luBusyBusiness.reset(); $scope.item = null; $scope.appUtils = AppUtilsBusiness; $scope.load = function() { articlesBusiness.getSingleById($stateParams.id, 'articles.view').then(function(data) { $scope.item = data; }, function (error) {}); }; if ($stateParams.item == null) { $scope.load(); } else { $scope.item = $stateParams.item; } }]);