Directives and variables

23 views Asked by At

I have in my directive the controller and link in the following way:

myapp.directive('MyDirective', function(){
    return{
        restrict: 'A',
        transclude: true,
        scope: {
          ....
        },
        controller: function($scope) {
           $scope.variable = true;

        },
        templateUrl:  './app/templates/template.html',
        link: function(scope, element, attrs){
            scope.$watch('variable ', function(){
            console.log("variable : " + scope.variable )
          });
       }
       .....

I am not able to see the scope.variable in the block link. How I can resolve it?

0

There are 0 answers