Search code examples
angularjsangularjs-scopeyandex-maps

How update variable on click on yandex maps


I want update variable when I click first time on yandex map.But it is not working. Handler of click on map is called definitely, but variable value is not updating. Here is jsfiddle. When I click on map I want update filter.step variable.


Solution

  • If you change anything inside non angular components it won't run $digest to make effect of changes to everywhere it linked.

    You need to apply changes for non angular components.

    Try $scope.$apply()

    Like this

      $scope.$apply(function(){
        $scope.filter.step = 2;
      })
    

    DEMO