Sunday, 15 June 2014

javascript - Angular bind non-Angular Event to scope -



javascript - Angular bind non-Angular Event to scope -

is possible bind non-angular event $scope-function?

i have div. in div, i'm not allowed bind ngclick-event , should bind "customclick"-event. tried next executes function on $apply rather telling framework utilize function eventhandler:

<div id="mycustomdiv" customclick="{{ setselectedtab() }}"> ... </div>

is possible or can $scope-functions bind angular-directives? in controller $(element).bind i'd rather have part in view belongs.

see how access $scope variable in browser's console using angularjs? detailed examples of accessing $scope non-angular sources.

in case, believe next work:

<div id="mycustomdiv" customclick="angular.element('#mycustomdiv').scope().setselectedtab()"> ... </div>

this approach requires not run angular in production mode have access scope() function.

javascript jquery angularjs

No comments:

Post a Comment