sar
sar

Reputation: 1297

Read from properties file stored in system in angularjs

Could anyone tell me how to read properties file in Angularjs. Property file could be any where in system. I want something like , reading java file by specifying path. Thanks in advance

Upvotes: 1

Views: 4251

Answers (1)

rishi
rishi

Reputation: 1862

There are 2 ways. one is reading properties file in angularJs

    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);
  });
});

another is reading properties file in spring

  <bean id="messageSource"
  class="org.springframework.context.support.ReloadableResourceBundleMessageSource"    autowire="byName"> 
<property name="basename" value="classpath:messages" /> 
<property name="defaultEncoding" value="UTF-8" /> 
 <property name="cacheSeconds" value="1"/>
</bean>

Upvotes: 1

Related Questions