myApp.directive('qsetAnswer', function(){
var linker = function(scope,element,attr) {
console.log(scope.body); // this prints fine.
};
return {
restrict:'A',
scope: '=info',
template: '<h5> ' + scope.body + ' </h5>', // this gives error.
link: linker
}
});
The above gives:- scope not defined error
Edit:- the problem with template: '<h5>{{body}}</h5>', is that my {{body}} already contains html ie. <p> abc </p> doing it like template: '{{body}}' prints <p> abc </p> like a string.