我需要在前端(Angular 1)中显示以下JSON。
{
"test.employee.name" : "Royal"
}
想要在前端提供密钥和值。 json数据将存储在.json文件中。
答案 0 :(得分:0)
var app = angular.module("app", []);
app.controller("ListCtrl", ["$scope",
function($scope) {
var vm = this;
vm.events = {
"test.employee.name" : "Royal"
};
}
]);

<!DOCTYPE html>
<html>
<head>
<script data-require="angular.js@1.4.7" data-semver="1.4.7" src="https://code.angularjs.org/1.4.7/angular.js"></script>
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
</head>
<body ng-app='app'>
<div ng-controller="ListCtrl as home">
<div ng-repeat="(key,value) in home.events ">
"key is:" {{key }} "value is:" {{value}}</div>
</div>
</body>
</html>
&#13;