# passing ngModel and ngChange with custom directive under md-select

I am making a custom directive on top of md-select. I am having issues with default behavior of ngModel and ngChange. I can’t seem to make them both work together.

Currently I have this http://next.plnkr.co/edit/X34DUWtkyYhbwJP4?open=lib%2Fscript.js

The ngModel is being updated, but the ngChange doesnt seem to work.

I also tried a method shown in http://embed.plnkr.co/HZAHSyi9L8UQdE24zYYI/
but having issues when setting value with a timeout (assuming value comes from api).

app.controller("appCtrl", function($scope){$scope.items = [1,2,3,4,5,6];
$scope.foo=2; // this works$scope.bar = function(foo)  {
$scope.aux = foo; } setTimeout(function(){$scope.foo=5;
}, 0); // this doesnt work
});


I want to make these two attributes to work as default md-select does.

Source: AngularJS