I'm working on implementing a PUT method in my controller and need to bind the new value back to it. I've tried:
<div ng-app="myApp" ng-controller="personCtrl">
<form>
First Name: <input type="text" ng-model="firstName"><br>
Last Name: <input type="text" ng-model="lastName"><br>
<button ng-click="UpdateProfile()"> Update </button>
</form>
</div>
And then updated my controller like this:
<script>
var app = angular.module('myApp', []);
app.controller('personCtrl', function($scope) {
$scope.firstName = "Leo";
$scope.lastName = "Messi";
$scope.UpdateProfile = function()
{
$scope.newFirstName = firstName
}
});
</script>
However, I encountered an error stating that firstName is not defined. Any suggestions or tips would be greatly appreciated.