2015-06-18 3 views
0

Я пытаюсь получить доступ к объекту из select в моем контроллере, но единственное, что я получаю, - null и undefined.ngChange не подбирает изменения из модели

 <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"); 
        } 
       }); 

Вот экс данных:

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

Вы могли воспроизвести проблему в plunkr? –

+0

Typo in question, или вам не хватает конечной цитаты для 'ng-model =" currentChose'? –

+0

"только здесь .. fixed –

ответ

0

это был вопрос сфера, $ parent.currentChose зафиксировал его

Смежные вопросы