You will need to load the template in the link function in order to access the area, before you access the template itself either in the template or in compilation, look here: What are the advantages of the directive template function in Angularjs?
This is obvious if you really used the $ compilation service directly. When you call $ compile on any DOM, it returns a communication function, which you then call, passing the scope to execute it. Therefore, when you see this from this point of view, it is obvious that you will have no scope until the compilation is called and the link function is returned and then called using the scope ... it looks something like this :
$compile("<div ng-repeat='thing in things'></div>")({things:['thing1','thing2']});
Here are a little put on in the dark of your code:
editStudentAccountModule.directive('attributeInput', function () { return { restrict: "AE", scope:{info:"="}, link: function(scope){ var templateToUse = '../Templates/default.html'; if (scope.info.FieldTypeId == 1) { templateToUse '../Templates/dropdown.html'; } else if (scope.info.FieldTypeId == 2) { templateToUse '../Templates/radio.html'; }
source share