在 Angular 前端显示 JSON 键值
To present JSON key value in Angular front end
我需要在前端显示以下 JSON (Angular 1)。
{
"test.employee.name" : "Royal"
}
想在前端同时呈现键和值。 json 数据将存储在 .json 文件中。
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>
我需要在前端显示以下 JSON (Angular 1)。
{
"test.employee.name" : "Royal"
}
想在前端同时呈现键和值。 json 数据将存储在 .json 文件中。
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>