Option.SupplyData in spa Prerendering not working in production?












1















I folow tutorial .net core angular ssr in this link here,



in this part, I try passing some text and its working perfectly in development mode but not in production mode.



//on .net core

options.SupplyData = (context, data) =>
{
// Creates a new value that's passed to TypeScript code
data["meta"] = "title";
};




//angular, on main.server.ts


{ provide: 'MetaTitle', useValue: params.data.meta},


and i injecting to component to get data



constructor(
@Optional() @Inject("MetaTitle") private mtitle: any,
) {
}


i get value in development not in production code. how to resolve this, help










share|improve this question



























    1















    I folow tutorial .net core angular ssr in this link here,



    in this part, I try passing some text and its working perfectly in development mode but not in production mode.



    //on .net core

    options.SupplyData = (context, data) =>
    {
    // Creates a new value that's passed to TypeScript code
    data["meta"] = "title";
    };




    //angular, on main.server.ts


    { provide: 'MetaTitle', useValue: params.data.meta},


    and i injecting to component to get data



    constructor(
    @Optional() @Inject("MetaTitle") private mtitle: any,
    ) {
    }


    i get value in development not in production code. how to resolve this, help










    share|improve this question

























      1












      1








      1








      I folow tutorial .net core angular ssr in this link here,



      in this part, I try passing some text and its working perfectly in development mode but not in production mode.



      //on .net core

      options.SupplyData = (context, data) =>
      {
      // Creates a new value that's passed to TypeScript code
      data["meta"] = "title";
      };




      //angular, on main.server.ts


      { provide: 'MetaTitle', useValue: params.data.meta},


      and i injecting to component to get data



      constructor(
      @Optional() @Inject("MetaTitle") private mtitle: any,
      ) {
      }


      i get value in development not in production code. how to resolve this, help










      share|improve this question














      I folow tutorial .net core angular ssr in this link here,



      in this part, I try passing some text and its working perfectly in development mode but not in production mode.



      //on .net core

      options.SupplyData = (context, data) =>
      {
      // Creates a new value that's passed to TypeScript code
      data["meta"] = "title";
      };




      //angular, on main.server.ts


      { provide: 'MetaTitle', useValue: params.data.meta},


      and i injecting to component to get data



      constructor(
      @Optional() @Inject("MetaTitle") private mtitle: any,
      ) {
      }


      i get value in development not in production code. how to resolve this, help







      angular asp.net-core






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 2 at 0:59









      Dwi Yanuar IlhamDwi Yanuar Ilham

      18737




      18737
























          1 Answer
          1






          active

          oldest

          votes


















          0














          You didn't include much information about the project, so I'm going to make some assumptions to assist you. Go check these things out in your project




          1. assuming that you are using the Angular CLI, make sure that the /dist folder is producing an acceptable index.html


          2. make sure the /src/environment.prod.ts looks correct (similar in most cases) to the /src/environment/environment.ts file. This config file controls differences in production vs development builds on the Angular side.







          share|improve this answer
























          • hi, im using angular cli, the result of building angular is working fine and web is working. the only problem is passing value between the two.(.net core and angular) using supply data option.

            – Dwi Yanuar Ilham
            Jan 2 at 1:42











          • the only different environtment is UseAngularCliServer in development and not in production

            – Dwi Yanuar Ilham
            Jan 2 at 1:43











          • what happens when you overwrite that file with the contents of environment.ts and try ng build --prod?

            – Goku
            Jan 2 at 4:38











          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%2f54000160%2foption-supplydata-in-spa-prerendering-not-working-in-production%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









          0














          You didn't include much information about the project, so I'm going to make some assumptions to assist you. Go check these things out in your project




          1. assuming that you are using the Angular CLI, make sure that the /dist folder is producing an acceptable index.html


          2. make sure the /src/environment.prod.ts looks correct (similar in most cases) to the /src/environment/environment.ts file. This config file controls differences in production vs development builds on the Angular side.







          share|improve this answer
























          • hi, im using angular cli, the result of building angular is working fine and web is working. the only problem is passing value between the two.(.net core and angular) using supply data option.

            – Dwi Yanuar Ilham
            Jan 2 at 1:42











          • the only different environtment is UseAngularCliServer in development and not in production

            – Dwi Yanuar Ilham
            Jan 2 at 1:43











          • what happens when you overwrite that file with the contents of environment.ts and try ng build --prod?

            – Goku
            Jan 2 at 4:38
















          0














          You didn't include much information about the project, so I'm going to make some assumptions to assist you. Go check these things out in your project




          1. assuming that you are using the Angular CLI, make sure that the /dist folder is producing an acceptable index.html


          2. make sure the /src/environment.prod.ts looks correct (similar in most cases) to the /src/environment/environment.ts file. This config file controls differences in production vs development builds on the Angular side.







          share|improve this answer
























          • hi, im using angular cli, the result of building angular is working fine and web is working. the only problem is passing value between the two.(.net core and angular) using supply data option.

            – Dwi Yanuar Ilham
            Jan 2 at 1:42











          • the only different environtment is UseAngularCliServer in development and not in production

            – Dwi Yanuar Ilham
            Jan 2 at 1:43











          • what happens when you overwrite that file with the contents of environment.ts and try ng build --prod?

            – Goku
            Jan 2 at 4:38














          0












          0








          0







          You didn't include much information about the project, so I'm going to make some assumptions to assist you. Go check these things out in your project




          1. assuming that you are using the Angular CLI, make sure that the /dist folder is producing an acceptable index.html


          2. make sure the /src/environment.prod.ts looks correct (similar in most cases) to the /src/environment/environment.ts file. This config file controls differences in production vs development builds on the Angular side.







          share|improve this answer













          You didn't include much information about the project, so I'm going to make some assumptions to assist you. Go check these things out in your project




          1. assuming that you are using the Angular CLI, make sure that the /dist folder is producing an acceptable index.html


          2. make sure the /src/environment.prod.ts looks correct (similar in most cases) to the /src/environment/environment.ts file. This config file controls differences in production vs development builds on the Angular side.








          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 2 at 1:27









          GokuGoku

          69611445




          69611445













          • hi, im using angular cli, the result of building angular is working fine and web is working. the only problem is passing value between the two.(.net core and angular) using supply data option.

            – Dwi Yanuar Ilham
            Jan 2 at 1:42











          • the only different environtment is UseAngularCliServer in development and not in production

            – Dwi Yanuar Ilham
            Jan 2 at 1:43











          • what happens when you overwrite that file with the contents of environment.ts and try ng build --prod?

            – Goku
            Jan 2 at 4:38



















          • hi, im using angular cli, the result of building angular is working fine and web is working. the only problem is passing value between the two.(.net core and angular) using supply data option.

            – Dwi Yanuar Ilham
            Jan 2 at 1:42











          • the only different environtment is UseAngularCliServer in development and not in production

            – Dwi Yanuar Ilham
            Jan 2 at 1:43











          • what happens when you overwrite that file with the contents of environment.ts and try ng build --prod?

            – Goku
            Jan 2 at 4:38

















          hi, im using angular cli, the result of building angular is working fine and web is working. the only problem is passing value between the two.(.net core and angular) using supply data option.

          – Dwi Yanuar Ilham
          Jan 2 at 1:42





          hi, im using angular cli, the result of building angular is working fine and web is working. the only problem is passing value between the two.(.net core and angular) using supply data option.

          – Dwi Yanuar Ilham
          Jan 2 at 1:42













          the only different environtment is UseAngularCliServer in development and not in production

          – Dwi Yanuar Ilham
          Jan 2 at 1:43





          the only different environtment is UseAngularCliServer in development and not in production

          – Dwi Yanuar Ilham
          Jan 2 at 1:43













          what happens when you overwrite that file with the contents of environment.ts and try ng build --prod?

          – Goku
          Jan 2 at 4:38





          what happens when you overwrite that file with the contents of environment.ts and try ng build --prod?

          – Goku
          Jan 2 at 4:38




















          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%2f54000160%2foption-supplydata-in-spa-prerendering-not-working-in-production%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







          Popular posts from this blog

          android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

          SQL update select statement

          WPF add header to Image with URL pettitions [duplicate]