title: What's the best way to provide different behaviors in different environments in Angular?
body: <p>We've got a certain behavior related to the redirect after user login that we need to versions of:</p>
  <p>One for production, that is related to the external login service, and one for prod, that uses the internal login service.</p>
  <p>The first solution we came up with as putting each in a different file, and using angular.json to replace one with the other when it's in production.</p>
  <p>The solution ended up being something like this in angular.json:</p>
  <pre><code>          &quot;fileReplacements&quot;: [
              {
                &quot;replace&quot;: &quot;src/environments/environment.ts&quot;,
                &quot;with&quot;: &quot;src/environments/environment.prod.ts&quot;
              },               {
                &quot;replace&quot;: &quot;behavior.dev.ts&quot;,
                &quot;with&quot;: &quot;behavior.prod.ts&quot;
              }
            ],
  </code></pre>
  <p>This sparked certain worries about this being a good solution, best practices wise, and others suggested that we use providers and dependency injection, but I was wondering if there's other ways other than these two, and what would be considered the best practice regarding this.</p>