I would like to change update a directive each time a value is updated into a controller.
Unfortunately I don't manage to access the scope value from the directive.
Here's the code of the directive :
myApp.directive( 'raphael', function ($compile, $document, $timeout) {
return {
link: function ( scope, element, attrs ) {
var paper = new Raphael(element[0], 600, 600);
// I need it right here !
I've tried with $ watch:
scope: {variable: '='},
link: function ( scope, element, attrs ) {
scope.$watch(variable, function(){
console.log(variable);
but it's not working
Then, how could I do to "update" the whole directive each time the variable is updated in the controller?
thanks!