javascriptangularjsangularjs-directive

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


Solution

  • 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>