let say that I have this custom directive
<div ng-controller="MyCtrl">
<select ng-model="selectBox">
<option value="test">test</option>
</select>
<my-directive select="selectBox"></my-directive>
</div>
myApp.directive('myDirective', function () {
return {
restrict:'EA',
function (scope, element, attr) {
var atrib = scope.$eval(attr.select)
console.log(atrib);
}
}
});
whenever I execute the console.log command it returned with undefined
value. I heard about isolated scope. But for this environment I don't want to use isolated scope..
the question is how can I achieve these ?
UPDATE I update the question based on @dfsq answer but it still got nothing
UPDATE apparently if I wrapped the attr.select using scope.$eval and change the attribute from {{}} which is object wrapping I use string only it will work! thank you so much for your answer guys!