javascript - How to access a angular `value` outside the module? -


config.js

angular.module("steam")    .value("config", {    baseurl: "http://dev-back1.techgrind.asia/"  });

i have access value outside module replacing "http://dev .." config.baseurl

test.js

var frisby = require("frisby");    frisby.create("status test")    .get("http://dev-back1.techgrind.asia/scripts/rest.pike?request=test")    .expectstatus(200)    .toss();

you might reach outside module these. in opinion use .constant instead of .value constant rest endpoints etc.

var config = angular.injector(["ng", "module"]).get("config"); 

Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -