Reputation: 113
i just want to make work a watch expression into a modal , which is included in a html file .
Into my demo, there are 2 watches : one works and the other no.
http://plnkr.co/edit/bNF7Yw?p=info
Thank you
Upvotes: 0
Views: 297
Reputation: 50245
includemodal
should be under the scope of the ModalInstanceController since that model in defined under the template that is used for the modal. Updated Plunker
$scope.openAddProductModal = function ( ) {
var modalInstance = $modal.open({
templateUrl: 'AddProductModalContent.html',
controller: function ($scope, $modalInstance, $log) {
$scope.includemodal={search_value:''};
$scope.$watch('includemodal.search_value', function(new_val) {
console.log('includemodal.search_value ' + new_val);
});
$scope.ok = function () {
$modalInstance.close();
};
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
};
},
resolve: {
}
});
};
Upvotes: 1