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'}
]
}
Вы могли воспроизвести проблему в plunkr? –
Typo in question, или вам не хватает конечной цитаты для 'ng-model =" currentChose'? –
"только здесь .. fixed –