Hi, all!

I have problem with passing model into ng-summernote plugin 
(https://github.com/summernote/angular-summernote)


Here is my component:


<div id="summernote"
     config="ctrl.summernoteOptions"
     ng-model="ctrl.emailTpl"
     summernote>
</div>


ctrl here is controllerAs

emailTpl - string variable that provide default text


and such component code 


.directive('summernote', [function() {
  'use strict';

  return {
    restrict: 'EA',
    transclude: 'element',
    replace: true,
    require: ['summernote', '^?ngModel'],
    controller: 'SummernoteController',
    scope: {
      summernoteConfig: '=config',
      editable: '=',
      editor: '=',
      init: '&onInit',
      enter: '&onEnter',
      focus: '&onFocus',
      blur: '&onBlur',
      paste: '&onPaste',
      keyup: '&onKeyup',
      keydown: '&onKeydown',
      change: '&onChange',
      toolbarClick: '&onToolbarClick',
      imageUpload: '&onImageUpload',
      ngModel: '='
    },
    template: '<div class="summernote"></div>',
    link: function(scope, element, attrs, ctrls, transclude) {
      var summernoteController = ctrls[0],
          ngModel = ctrls[1];

      console.log(scope.ngModel);

      transclude(scope, function(clone, scope) {
        // to prevent binding to angular scope (It require `tranclude: 
'element'`)
        element.append(clone.html());
      });

      summernoteController.activate(scope, element, ngModel);
    }
  };


As you can see directives requires ngModel and angular usually creates 
ngModelController in such case, but in my case ngModel is null.


I add ngModel into scope object to be sure that correct variable passing into 
directive and it's true.


-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to