javascript - Is it possible to change Angular scope in jQuery event? -


thats code:

.directive('search', function($templaterequest, $compile) {         return {             link: function(scope, element, $scope){                 $templaterequest('/js/angularjs/search.html').then(function(html){                     var template = angular.element(html);                     element.append(template);                     $compile(template)(scope);                     $('#multipleselect').multipleselect({                         test: console.log($scope),                         onclick: function(view, scope) {                             //view.checked ? scope.searchbytitle.multi.push(view.value) : scope.searchbytitle.multi.remove(view.value);                             console.log('scope:');                             console.log($scope);                         }                     });                 });             }         };     }); 

i using plugin: http://wenzhixin.net.cn/p/multiple-select/docs/

i wanna achieve after change 1 of multiple select value, wanna push sth angularjs scope (bascially use onclick event). scope not accessible inside jquery function...

if have workaround idea this, i'd hear :p

onclick: function(view, scope) {     var scope = angular.element($("#multipleselect")).scope();     view.checked ? scope.searchbytitle.multi.push(view.value) : scope.searchbytitle.multi.remove(view.value); } 

thats solution managed find. works :)


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -