有没有办法从位于Web服务器外部的angularjs读取属性文件?
就像在java中部署的属性文件一样,但我们可以在我们的项目中将这些文件作为filter.properties读取,这样任何解决方案都在angularJS中.
我试过这样但是未定义.
filter.properties:
key1=value1
key2=value2
Run Code Online (Sandbox Code Playgroud)
sampleController.js
var app = angular.module('sampleApp', []);
app.controller('sampleController', function($scope, $http) {
$http.get('filter.properties').then(function (response) {
console.log('a is ', JSON.stringify(response.data.key1));
});
});
Run Code Online (Sandbox Code Playgroud)