(function (module) {
    module.controller('ProjectHomeController', ProjectHomeController);
    ProjectHomeController.$inject = ["project", "modalInstance", "processTemplates", "$state"];

    function ProjectHomeController(project, modalInstance, processTemplates, $state) {
        var ctrl = this;

        ctrl.project = project;
        ctrl.chooseTemplate = chooseTemplate;
        ctrl.createSample = createSample;

        /////////////////////////

        function chooseTemplate() {
            modalInstance.chooseTemplate(ctrl.project);
        }

        function createSample() {
            var template = processTemplates.getTemplateByName('As Received');
            processTemplates.setActiveTemplate(template);
            $state.go('projects.project.processes.create');
        }
    }
}(angular.module('materialscommons')));

(function (module) {
    module.controller('ProjectHomeController', ProjectHomeController);
    ProjectHomeController.$inject = ["project", "modalInstance", "templates", "$state"];

    function ProjectHomeController(project, modalInstance, templates, $state) {
        var ctrl = this;

        ctrl.project = project;
        ctrl.chooseTemplate = chooseTemplate;
        ctrl.createSample = createSample;

        /////////////////////////

        function chooseTemplate() {
            modalInstance.chooseTemplate(ctrl.project, templates).then(function(processTemplateName) {
                $state.go('projects.project.processes.create', {process: processTemplateName});
            });
        }

        function createSample() {
            $state.go('projects.project.processes.create', {process: 'As Received'});
        }
    }
}(angular.module('materialscommons')));

Simplify the dependencies and wait on the chooseTemplate service (modal) to return the process to create.
Simplify the dependencies and wait on the chooseTemplate service (modal) to return the process to create.
