ngChange is not picking up changes from the model

54 views Asked by At

I am trying to access the obj from the select in my controller but the only thing that I end up getting is null and undefined.

        <select
        ng-change="watchActions(part)" 
        ng-options="part.serial as part.description for part in rawBaList.items" 
        ng-model="currentChose"
        ></select>

             $scope.currentChose = null;

             $scope.watchActions = function (obj) {
                  console.log($scope.currentChose);
                  console.log(obj);
              };

                $scope.$watch('currentChose', function (newValue, oldValue) {
                    if(newValue){
                        console.log("here the new value goes");
                    }
                });

Here is the ex of data:

{
count: 2,
items: [
{serial: 2, description: 'here is some description'},
{serial: 24, description: 'some other description'}
]
}
1

There are 1 answers

0
Andre Kuznetcov On

it was a scope issue, $parent.currentChose fixed it