angular.module('app') .controller('articlesEditController', ['$scope', '$stateParams', 'articlesBusiness', 'editControllerBuilder', function ($scope, $stateParams, articlesBusiness, editControllerBuilder) { $scope.business = articlesBusiness; $scope.itemType = 'articles'; editControllerBuilder.create($scope, $stateParams); $scope.addField = function() { var field = $scope.business.initFieldDbo({}); $scope.item.fields.push(field); }; $scope.setupExitConfirm(); $scope.init($stateParams); }]);