JSFiddle - React, Tailwind, and code Playground
HTML
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.5/angular.js"></script>
<div ng-app="myApp" ng-controller="demoCtrl">
<input ng-model="entity[locationKey][cityKey]"/>
<div>{{entity | json}}</div>
</div>
JavaScript
var app = angular.module('myApp', []);
app.controller('demoCtrl', function ($scope) {
$scope.entity = {
firstName: 'Jack',
lastName: 'Bauer',
city: 'LA',
location: {
city: 'New York'
}
};
$scope.locationKey = 'location';
$scope.cityKey = 'city';
});