My view is simple:
<job-template ng-if="job"></job-template>
My directive:
.directive('jobTemplate', function(){
return {
restrict: 'AE',
replace: true,
link: function(scope,element, attrs) {
var JobStatus = scope.job.JobStatus;
var text = "<p>";
if(JobStatus === 'Created'){
text += "{{job.id}} was created."
}
else if(JobStatus === 'Processing'){
text += "{{job.id}} is currently processing."
}
text += "</p>";
console.log("text");
console.log(text);
return text;
}
};
})
When I run my page, my <job-template> element isn't replaced with anything - although the correct text is loaded to the console.
What have I done wrong here?