Angular 2 making one "generic" component out of 2 almost identical components
<p>I have 2 components that are almost identical and for code reusability I would like to combine those to use in different places in my project. Both are dropdownlists with a checkbox. Only difference is the data that comes in and out.</p>

<pre><code>import {ROUTER_DIRECTIVES, RouteConfig, RouteParams, Router, RouterOutlet, RouterLink} from 'angular2/router';
import {FORM_PROVIDERS, FORM_DIRECTIVES, Control, NgClass, NgIf, CORE_DIRECTIVES} from 'angular2/common';
import {Component, Inject, Input, OnInit, OnChanges} from 'angular2/core';
import {Http, Headers, ContentHeaders, HTTP_PROVIDERS} from 'angular2/http';
import {User} from '/app/interfaces';
import {ActualsComponent } from '../actuals/actual.component';
import {ProjectService} from '../../projects/project.service';
import {LoginService} from '../../login/login.service';
import {SearchPipe} from '../custom-pipes/search-pipe';

@Component({
    selector: 'dropdown-users',
    templateUrl: 'app/templates/elements/dropdown-users.html',
    providers: [FORM_PROVIDERS, HTTP_PROVIDERS, ProjectService, LoginService],
    directives: [ROUTER_DIRECTIVES, FORM_DIRECTIVES, RouterLink, CORE_DIRECTIVES, RouterOutlet],
    pipes: [SearchPipe]
})

export class DropDownUsers implements OnInit, OnChanges{
    projectdata: Object;
    selectedUsers: Object;

    public showMenu: boolean;
    projectSearchTerm: Control = new Control();
    projectcount: number;

    constructor(@Inject(ProjectService) projectService: ProjectService, @Inject(LoginService) loginService: LoginService, private http: Http,  params: RouteParams) {
        this.showMenu = false;
        loginService.authenticate("user", "pwd");
        this.projectdata = loginService.data;
        this.projectcount = 0;
        this.selectedUsers = new Array();

    }
    addUser(user: User){
        this.selectedUsers.push(user);
    }
}
</code></pre>

<p>The other component is the same, except it works with users instead of projects.</p>