Join the Stack Overflow Community
Stack Overflow is a community of 6.7 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

I would like to select a directive via a string.

The controller would look like this:

app.controller('demo_ctrl',function($scope){
  $scope.directiveName = 'theName';
});

And in the HTML it should look something like this:

<div directive="directiveName"></div>

The controller I want to target is like this:

app.directive('theName',  function() {
  return {
    restrict: 'E',
    scope: {
      value: '=',
    },
    template: '<div class="theClass">theName: {{value}}</div>',
    controller: function($scope) {
      console.log($scope.value);
    }
  }
});

I don't want to access the controller I want to select the directive. Is there a way of doing that?

share|improve this question
    
Possible duplicate of Access controller scope from directive – Mistalis 22 hours ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.