what is the design choice to follow with nrwl nx angular










0















I am using nrwl Nx for my app developement. So far I have been following like this.



  • Created separate library for my lazy loaded feature. eg: i have a news module where I have news add/delete/update features. This library has all the required services and routing.


  • Loading the above library into my app does the job well.


Problem started after a while.
- when I needed some of the component I used in the news library in other application which does not need the entire module. It needed one or two of the components.



  • then I had to refactor those components to become dump by extracting out the service injection and the made @input for data.

Now I need to create new module. which does the same as above but for adding events/annoucements.



my query- should I follow the above mentioned way like news module



or the following way.



  • create library with just components and services. Do not use the services in the library (inject to any component in the library).


  • use the library service in the application and use the components from the library to display item by giving the required @Input.


  • have all the routes and every other navigation handled in the application.


  • so the library will just be a place to have all the components and services mentioned. nothing more..


I anybody gets what I am trying to say.. Which way would you prefer to proceed.










share|improve this question


























    0















    I am using nrwl Nx for my app developement. So far I have been following like this.



    • Created separate library for my lazy loaded feature. eg: i have a news module where I have news add/delete/update features. This library has all the required services and routing.


    • Loading the above library into my app does the job well.


    Problem started after a while.
    - when I needed some of the component I used in the news library in other application which does not need the entire module. It needed one or two of the components.



    • then I had to refactor those components to become dump by extracting out the service injection and the made @input for data.

    Now I need to create new module. which does the same as above but for adding events/annoucements.



    my query- should I follow the above mentioned way like news module



    or the following way.



    • create library with just components and services. Do not use the services in the library (inject to any component in the library).


    • use the library service in the application and use the components from the library to display item by giving the required @Input.


    • have all the routes and every other navigation handled in the application.


    • so the library will just be a place to have all the components and services mentioned. nothing more..


    I anybody gets what I am trying to say.. Which way would you prefer to proceed.










    share|improve this question
























      0












      0








      0








      I am using nrwl Nx for my app developement. So far I have been following like this.



      • Created separate library for my lazy loaded feature. eg: i have a news module where I have news add/delete/update features. This library has all the required services and routing.


      • Loading the above library into my app does the job well.


      Problem started after a while.
      - when I needed some of the component I used in the news library in other application which does not need the entire module. It needed one or two of the components.



      • then I had to refactor those components to become dump by extracting out the service injection and the made @input for data.

      Now I need to create new module. which does the same as above but for adding events/annoucements.



      my query- should I follow the above mentioned way like news module



      or the following way.



      • create library with just components and services. Do not use the services in the library (inject to any component in the library).


      • use the library service in the application and use the components from the library to display item by giving the required @Input.


      • have all the routes and every other navigation handled in the application.


      • so the library will just be a place to have all the components and services mentioned. nothing more..


      I anybody gets what I am trying to say.. Which way would you prefer to proceed.










      share|improve this question














      I am using nrwl Nx for my app developement. So far I have been following like this.



      • Created separate library for my lazy loaded feature. eg: i have a news module where I have news add/delete/update features. This library has all the required services and routing.


      • Loading the above library into my app does the job well.


      Problem started after a while.
      - when I needed some of the component I used in the news library in other application which does not need the entire module. It needed one or two of the components.



      • then I had to refactor those components to become dump by extracting out the service injection and the made @input for data.

      Now I need to create new module. which does the same as above but for adding events/annoucements.



      my query- should I follow the above mentioned way like news module



      or the following way.



      • create library with just components and services. Do not use the services in the library (inject to any component in the library).


      • use the library service in the application and use the components from the library to display item by giving the required @Input.


      • have all the routes and every other navigation handled in the application.


      • so the library will just be a place to have all the components and services mentioned. nothing more..


      I anybody gets what I am trying to say.. Which way would you prefer to proceed.







      angular nrwl






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 13 '18 at 4:06









      JayJay

      1769




      1769






















          1 Answer
          1






          active

          oldest

          votes


















          1














          The general idea is for a library to focus on something specific. In your case it sounds like you need a few libraries:



          • one that handles the routing for the lazy-loaded routes for a particular domain (the feature) e.g. "customers"

          • one for your dumb components (these can be nested inside folders like "customer" or "shared")

          • one for data-access, which looks after API calls and state management in your domain (e.g. "customer" or "shared")

          The main app should only set up the overall routing and nothing else. You can read Victor's article on this here: https://blog.nrwl.io/building-full-stack-applications-using-angular-cli-and-nx-5eff205248f1






          share|improve this answer






















            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53273638%2fwhat-is-the-design-choice-to-follow-with-nrwl-nx-angular%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            The general idea is for a library to focus on something specific. In your case it sounds like you need a few libraries:



            • one that handles the routing for the lazy-loaded routes for a particular domain (the feature) e.g. "customers"

            • one for your dumb components (these can be nested inside folders like "customer" or "shared")

            • one for data-access, which looks after API calls and state management in your domain (e.g. "customer" or "shared")

            The main app should only set up the overall routing and nothing else. You can read Victor's article on this here: https://blog.nrwl.io/building-full-stack-applications-using-angular-cli-and-nx-5eff205248f1






            share|improve this answer



























              1














              The general idea is for a library to focus on something specific. In your case it sounds like you need a few libraries:



              • one that handles the routing for the lazy-loaded routes for a particular domain (the feature) e.g. "customers"

              • one for your dumb components (these can be nested inside folders like "customer" or "shared")

              • one for data-access, which looks after API calls and state management in your domain (e.g. "customer" or "shared")

              The main app should only set up the overall routing and nothing else. You can read Victor's article on this here: https://blog.nrwl.io/building-full-stack-applications-using-angular-cli-and-nx-5eff205248f1






              share|improve this answer

























                1












                1








                1







                The general idea is for a library to focus on something specific. In your case it sounds like you need a few libraries:



                • one that handles the routing for the lazy-loaded routes for a particular domain (the feature) e.g. "customers"

                • one for your dumb components (these can be nested inside folders like "customer" or "shared")

                • one for data-access, which looks after API calls and state management in your domain (e.g. "customer" or "shared")

                The main app should only set up the overall routing and nothing else. You can read Victor's article on this here: https://blog.nrwl.io/building-full-stack-applications-using-angular-cli-and-nx-5eff205248f1






                share|improve this answer













                The general idea is for a library to focus on something specific. In your case it sounds like you need a few libraries:



                • one that handles the routing for the lazy-loaded routes for a particular domain (the feature) e.g. "customers"

                • one for your dumb components (these can be nested inside folders like "customer" or "shared")

                • one for data-access, which looks after API calls and state management in your domain (e.g. "customer" or "shared")

                The main app should only set up the overall routing and nothing else. You can read Victor's article on this here: https://blog.nrwl.io/building-full-stack-applications-using-angular-cli-and-nx-5eff205248f1







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 17 '18 at 16:11









                electricheadelectrichead

                702417




                702417



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53273638%2fwhat-is-the-design-choice-to-follow-with-nrwl-nx-angular%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    這個網誌中的熱門文章

                    How to read a connectionString WITH PROVIDER in .NET Core?

                    In R, how to develop a multiplot heatmap.2 figure showing key labels successfully

                    Museum of Modern and Contemporary Art of Trento and Rovereto