In my controller I've defined $scope.worker which is a plain JS object:
{
name: 'Peter',
phone: 601002003
}
I've created a directive:
.directive('phoneType', [function () {
return {
restrict: 'A',
link: function (scope, element, attrs) {
console.log(attrs);
}
};
}])
and my HTML looks like this:
<span phone-type="worker.phone"></span>
How do I pass worker.phone (in this example 601002003) from the controller scope to the directive, so I can create my logic in the link method? attrs.phoneType right now shows me worker.phone string.