Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

fix(mdAutocomplete): Fix scope watch bug. #4715

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function MdAutocompleteItemScopeDirective($compile, $mdUtil) {
};

function postLink(scope, element, attr) {
var ctrl = scope.$mdAutocompleteCtrl;
var ctrl = scope.$mdAutocompleteCtrl;
var newScope = ctrl.parent.$new();
var itemName = ctrl.itemName;

Expand All @@ -32,10 +32,13 @@ function MdAutocompleteItemScopeDirective($compile, $mdUtil) {
* @param variable
* @param alias
*/
function watchVariable (variable, alias) {
$mdUtil.nextTick(function () {
newScope[alias] = scope[variable];
scope.$watch(variable, function (value) { newScope[alias] = value; });
function watchVariable(variable, alias) {
newScope[alias] = scope[variable];

scope.$watch(variable, function(value) {
$mdUtil.nextTick(function() {
newScope[alias] = value;
});
});
}
}
Expand Down