Woot4Moo Woot4Moo - 1 year ago 1120
AngularJS Question

angularjs read from properties file

In angularJS how can I read a value from a properties file?


user= "me"
get= "GET"
post= "POST"


var app = angular.module('testing',[]);
app.controller('testCtrl',function($scope,$http) {
url: connection.properties.url ,
method: connection.properties.get,
params: {user: connection.properties.user})

Answer Source

If connection.properties is a file that lives on your web server, then you simply need to do this:

var app = angular.module('app', []);

app.controller('test', function ($scope, $http) {
  $http.get('connection.properties').then(function (response) {
    console.log('a is ', response.data.a);
    console.log('b is ', response.data.b);

You can see an example here:


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download