I have a custom directive that I would like to inherit the parent scope. I would also like to pass a value via an attribute. It looks like this:
Controller
app.controller('Main', ['$scope', function($scope){
$scope.cols = { 'col1': true, 'col2':false, 'col3': true};
$scope.toggleCol = function(colName){
$scope.cols[colName] = !$scope.cols[colName];
};
}]);
Directive
wrApp.directive("custTh", function(){
return {
restrict: "EA",
scope: false,
replace: true,
template: '<th ng-show="cols[{{ colname }}]" ng-click="toggleCol({{ colname }})">{{ colname }}</th>',
};
});
HTML
<th cust-th colname="col2"></th>
I just can't seem to get access to the attribute value bc I am inheriting the parent scope. Is it possible to directly access directive attributes from the template?