0

I am using dhtmlxScheduler and angular js. I inserted an ng-model attribute within checkbox and select element of lightbox of dhtmlxScheduler - ng-model="isallday".

    link:function($scope, $element, $attrs, ...) {
    ...
    angular.element(document.querySelector( '[name="isallday"]' )).attr('ng-model', 'isallday');
    angular.element( document.querySelector( ".dhx_section_time" )
    .getElementsByTagName("select") ).attr('ng-class', '{dhx_time_disable: isallday}');

Clicking on the checkbox doesn't work. What am I doing wrong?

stsatlantis
  • 555
  • 9
  • 26
Eric Chan
  • 1,192
  • 4
  • 16
  • 30

1 Answers1

0

ng-model is directive. But you are just adding an attribute to your element. It is not seen by angular. check this out Dynamically add directive in AngularJS

Community
  • 1
  • 1
ram1993
  • 979
  • 1
  • 9
  • 13
  • I just found a solution. var el = angular.element(...); $injector = el.injector(); $injector.invoke(function($compile){ $compile(el)($scope); }) Anyway, thank you for your answer. – Eric Chan Sep 29 '16 at 20:07
  • ya, I was going to say you would need to run `$compile(element)($scope);` – plong0 Sep 29 '16 at 21:31