FIDDLE
I have created a directive :-
return {
restrict: \'EAC\',
scope: {
statesActive: \'=\'
},
A slight tweak to the fiddle was referenced in a comment to another answer that now shows the retrieval of states within the directive's link function via its scope:
link: function (scope, element, attrs) {
var stateData = $parse(scope.statesActive)();
console.log(stateData);
}
by stating:
scope: { statesActive: '=' }
you are binding your directive's scope to the attribute named states-active
so all you have to do reference it inside the directive is to use
scope.statesActive
this will get the value as a string, you can use the $parse service to get the value of your object