Jump to content

Help needed with gulp-ng-config in angular js


MegaPowerRockstar

Recommended Posts

Hi Guys,
I am trying to explore "gulp-ng-config" implementation for environment variables.
Did anyone use it need help in implementing this.

I did research online, but those examples dont help me in getting output. Since it it generates .json file to .js on the fly, i am like clueless whats going on.

Can someone please help me this with complete implementation (from gulpfile.js to consuming them in module).
I am stuck with issue unable to inject the .js file that will be generated.

Link to comment
Share on other sites

10 minutes ago, MegaPowerRockstar said:

Hi Guys,
I am trying to explore "gulp-ng-config" implementation for environment variables.
Did anyone use it need help in implementing this.

I did research online, but those examples dont help me in getting output. Since it it generates .json file to .js on the fly, i am like clueless whats going on.

Can someone please help me this with complete implementation (from gulpfile.js to consuming them in module).
I am stuck with issue unable to inject the .js file that will be generated.

I can’t bro, ltt

  • Thanks 1
Link to comment
Share on other sites

On 2/16/2018 at 12:01 PM, MegaPowerRockstar said:

Hi Guys,
I am trying to explore "gulp-ng-config" implementation for environment variables.
Did anyone use it need help in implementing this.

I did research online, but those examples dont help me in getting output. Since it it generates .json file to .js on the fly, i am like clueless whats going on.

Can someone please help me this with complete implementation (from gulpfile.js to consuming them in module).
I am stuck with issue unable to inject the .js file that will be generated.

froxy call cheyi 

Link to comment
Share on other sites

40 minutes ago, jpismahatma said:

Fleez...

  1. Settings Json file (envSettings.json):
    {
      "global": {
        "version": "0.1.0"
       },
      "env": {
        "local": {
          "EnvironmentConfig": {
            "SiteApi": "http://localhost:80405"
          }
        }
        }  
    }
     
  2. In Gulpfile: // we can multiple for environment specific
    gulp.task('configuration', function () {
        return gulp.src('envSettings.json')
            .pipe(gulpNgConfig('application.config', {
                environment: [paths.env, 'global']
                }))
            .pipe(gulp.dest('app/config/envSettings.js'));
    });

    gulp.task('default', function () {
        paths.env = 'env.local';
        runSequence('configuration');
    });
     
  3. Main app:
    angular.module('myapp', ['myapp.components', 'myapp.config']);
     
  4. In your controller:

    angular.module('myapp.components').directive('userUpgrade', userUpgrade);
        userUpgrade.$inject = ['EnvironmentConfig'];
        function userUpgrade(EnvironmentConfig) {
                     console.log(EnvironmentConfig.SiteApi);
          }

 

Link to comment
Share on other sites

On 2/16/2018 at 12:16 PM, MegaPowerRockstar said:

some one pls jump in and help me... Angular + .net guys helppppppp

try for sometime, even if its not working, then self quit the job. Learn stuff and then join the new job.

Link to comment
Share on other sites

1 hour ago, AlaElaAlaEla said:

try for sometime, even if its not working, then self quit the job. Learn stuff and then join the new job.

i didnt invite people like you.... and moreover dont just randomly give replies.. no one uses gulp with .net first you know that...

You do your selfish job

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...