Как импортировать Modernizr в React

Вы должны compile html привязать directives, как ng-click к свойствам области. Другие недостаточные угловые директивы не будут привязываться к свойствам области.

var strElm = '<button class="btn btn-info" ng-click="selectProperties()" title="Assign this user"><span class="glyphicon glyphicon-user"></span>Assignment</button>';
var compiledHtml = $compile(strElm);
element.append(compiledHtml);

и не удалять службу $compile из директивы,

и ваш код должен выглядеть следующим образом:

//Establishes the type of question and therefore what should be displayed
app.directive('questionType', function($http, $compile) {
  return {
    restrict: 'A',
    link: function(scope, element, attr, model) {

      switch (scope.Question.inputType) {
        case 'checkbox':
          //element.append('<input type="checkbox" ng-model="Question.checked"/><button ng-if="input.checked" >X</button>');
          break;
        case 'text':
          var strElm = '<button class="btn btn-info" ng-click="selectProperties()" title="Assign this user"><span class="glyphicon glyphicon-user"></span>Assignment</button>';
          var compiledHtml = $compile(strElm);
          element.append(compiledHtml);
          break;
      }
    }
  };
});

0
задан Lee O. 16 January 2019 в 05:41
поделиться