I know I shouldn't be using jQuery in combination with Angular, but this is just for the demonstration purposes.
I'm struggling with understanding as to how to inject/insert a directive's attribute inside the controller?
Code:
var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope) {
  $('#myDiv1').html('<p>This works</p>');
  //this below doesn't work when injecting directive attribute
  $('#myDiv2').html('<p my-directive></p>');
})
.directive("myDirective", [function () {
        return {
        restrict: 'EAC',
        require: '?ngModel',
        link: function($scope, element, attrs, controller) {
          var controllerOptions, options;
          element.text('Hello There');
        }
      };
}]);
Can anyone help please? Is there a way to achieve this?
 
    