interpolated attrs $observe

by bmleite

HTML

<div ng-controller="Ctrl">
  <test func="hohoho"></test>
<div>

JavaScript

var app = angular.module('app', []);

function Ctrl($scope) {
}

app.directive('test', function () {
  return {
    restrict: 'E',
    scope: {
      parentFunc: '@func'
    },
    link: function (scope, element, attrs) {
      var func = '';

      attrs.$observe('func', function (val) {
        func = val;
        console.log('3', func);
      });
      console.log('end');
      console.log('1', func);
      console.log('2', scope.parentFunc);

    }
  };
});