I want to pass a string into an angular directive,
<person first-name="Don" last-name="Dood"></person>
<person first-name="James" last-name="Jawalla"></person>
and get this result HTML:
<p>Don Dood</p>
<p>James Jawalla</p>
Here is what I currently have.
Directive:
.directive('person', function(){
return {
scope: {
firstName: '@',
lastName: '@'
},
templateUrl: 'person-template.html'
}
});
person-template.html
<p>{{ firstName }} {{ lastName }}</p>
However there are no values appearing for firstName or lastName. What am I missing?
It's a simple question, so I'm surprised there is no good answer on SO. Closest I found was this question, but it does not say how to show a string in HTML.