I have a custom directive which has got it's own scope which accepts values from the directive's DOM attributes but there are a few vars from the $scope which I want to access from the directive too. Can anyone help me to do this.
Here is my directive and how I use it.
appDirectives.directive('appTemplate', function () {
return {
restrict: 'E',
templateUrl: 'partials/templates/template.html',
scope: {
template: '='
},
}
});
<div ng-repeat="template in templates" ng-click="chooseTemplate(template)">
<app-template template="template"></app-template>
</div>
And this is the template of the directive and here I have template value but I want also to access $scope.rootPath
<div class="template">
{$ ???scope.rootPath??? $}
{$ template is accesable $}
</div>
rootPathas an attribute to the isolated scope of directive?scope: { template: '=', rootpath: '@' }inside directive. and then pass in the rootpath as attr where the directive is used?