app.js
is:
directive('test', ['name', function ($name) {
return {/// DDO
template:'<h1>'.$name.'<h1>',
link: function () {
console.log($name);
}
};
}]).
While above name
a service, which I am injecting into above directive. Above code works fine and data shows up both in console
and web page
.
BUT
error occurs when I replace template: $name
with template: '<h1>'.$name.'</h1>'
.
The error I get is this:
Uncaught SyntaxError: Unexpected string
So if I can't concatenate string named $name
like that with <h1>
tags then how do I do it there inside the DDO
?
Note: Above given code is definitely not complete code, it's just the part I had problem with. Also service named name
was declared/defined/created(or whatever it's called) by using value
function.