How to develop several modules parallel to the application module in Angular 2?

I am developing a large Angular 2 application. To do this, I need to create a separate module for common core components, services, etc. My main application will be developed in a directory src/app, and I want my main components to be developed in src/core. And any future subprojects for this project will be developed in src/feature, etc. So the final directory structure will be,

MyProject/
    config/
    dist/
    e2e/
    public/
    src/
        app/
        core/
        feature_1/
        feature_2/
    ...

How does Angular 2 support this behavior?

PS: I am using the latest versions of Angular 2, currently rc-4 (with Angular CLI).

+4
source share
1 answer

components feature_x

MyProject/
    config/
    dist/
    e2e/
    public/
    src/
        app/
        core/
        feature_1/components
                            /app
                            /search-x
                            /nav-menu
        feature_2/components
    ...

app app.html

<div class='container-fluid'>
    <div class='row'>
        <div class='col-sm-3'>
            <nav-menu></nav-menu>
        </div>
        <div class='col-sm-9 body-content'>
            <router-outlet></router-outlet>
        </div>
    </div>
</div>
0

Source: https://habr.com/ru/post/1650270/


All Articles