company-list.js

angular.module('homepage').
directive('companyList', function() {
    return {
        restrict: 'E',
        replace: true,
        scope: {
            companies: '=data'
        },
        templateUrl: 'components/content-components/input/company-list.html',
        controller: 'companyListController'
    };
}).
controller('companyListController', function($scope, Company, Project) {
    if(!$scope.companies || $scope.companies.length === 0) {
        $scope.companies = [];
        $scope.companies[0] = new Company();
    }

    $scope.addProject = function (index) {
        var length = $scope.companies[index].projects.length;
        $scope.companies[index].projects[length] = new Project();
    };

    $scope.addCompany = function () {
        var length = $scope.companies.length;
        $scope.companies[length] = new Company();
    };
});