Question: I am trying to bind the ng-model parameter which was initially set in a controller back to the controller 
I have something like this 

```
    <div ng-app="myApp" ng-controller="personCtrl">

     First Name: <input type="text" ng-model="firstName"><br>
     Last Name: <input type="text" ng-model="lastName"><br>
      </div>

    <script>
        var app = angular.module('myApp', []);
        app.controller('personCtrl', function($scope) {
        $scope.firstName = "Leo";
        $scope.lastName = "Messi";

        });
    </script> 

```

I am trying to implement a PUT method in my controller, so I needed to bind the new value back to the controller . I 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>

```

then in I updated my controller to

```
       <script>
        var app = angular.module('myApp', []);
        app.controller('personCtrl', function($scope) {
        $scope.firstName = "Leo";
        $scope.lastName = "Messi";
        $scope.UpdateProfile = function()
           {
               $scope.newFirstName = firstName
           }
        });
    </script>  

```

But I got an error saying firstName is not define.

any help would be appreciated

Answer: 
Alternatively you can make some changes to get your own version functioning..  

**In controller:**

```
$scope.UpdateProfile = function(firstName)
{
    $scope.newFirstName = firstName
}

```

**In HTML:**

```
<button ng-click="UpdateProfile(firstName)"> Update </button>

```
You already Pre-defined Scopes by filling Some values .Scope recognizes the Updated values it self .

Update your Code just like the Following :-

```
 $scope.newFirstName = $scope.firstName;
 $scope.newLastName = $scope.lastName;

```

<https://plnkr.co/edit/NsoxahPcGUBtTYTlruBJ?p=preview>

<https://docs.angularjs.org/guide/scope> - can give you more information for better Understanding !!