angularjs - Watch expression does not work in modal included -


i want make work watch expression modal , included in html file .

into demo, there 2 watches : 1 works , other no.

http://plnkr.co/edit/bnf7yw?p=info

thank you

includemodal should under scope of modalinstancecontroller since model in defined under template used 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: {              }           });   }; 

Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -