ng-model assignable expression

by robertjd

HTML

<div ng-app="App">
    <div ng-controller="cbt">
        Check me to check both: <input type="text" ng-model="values[nameOfModel]"/><br/>
    </div>
</div>

JavaScript

var App = angular.module('App',[])
.controller('cbt', ['$scope',function($scope) {
    $scope.nameOfModel = "email"
    $scope.values={
        email : "test"
    }
}])