0

I have the following directive in html:

<as-excel-download institutionId="vm.reportInstitution.id"></as-excel-download>

the directive looks like this:

(function() {
'use strict';

angular
    .module('aposoft.common')
    .directive('asExcelDownload', asExcelDownload);

function asExcelDownload() {
    var directive = {
        restrict: 'E',
        scope: {                
            institutionId: '='
        },
        templateUrl: 'app/common/exceldownload/asExcelDownload.html'
    };
    return directive;

    ////////////
}
})();

and the directive template looks like this:

<a href="/api/schedulerecordexcel/monthreport/{{institutionId}}">
  <img src="./Excel.PNG" alt="icon" />
</a>

and actually I don't know why {{institutionId}} is emty in directive template html. If I change institutionId into vm in every of the above files (which is the scope in controller) and access institution id over vm in directive template html than everything works fine. Does anyone know what I am doing wrong here?

3
  • Do you see anything in the console? Commented Aug 1, 2016 at 13:25
  • no, there is no error in the firefox firebug console. Commented Aug 1, 2016 at 13:28
  • Can you console.log(institutionId) inside the directive link to see what the value is of institutionId is? and maybe checked the passes value vm.reportInstitution.id for correctness? Commented Aug 1, 2016 at 13:30

1 Answer 1

1

I think you are using wrong name as attribute, so basically this part:

<as-excel-download institutionId="vm.reportInstitution.id"></as-excel-download>

Should look like this:

<as-excel-download institution-id="vm.reportInstitution.id"></as-excel-download>
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.