I\'m trying to re-use a portion of my HTML view in multiple places. The portion I want to re-use is table cells in an HTML table. The problem is that my custom directive i
Here is how you can further improve your directive so that it is more re-usable. and pass in the value of is known to behave strangely in directives like this. Instead, use a directive on the parent . Read more about this issue here: https://github.com/angular/angular.js/issues/1459
app.directive('myElement', function () {
return {
scope: {
item: '=myElement'
},
restrict: 'EA',
template: '
Name: {{item.name}} Age: {{item.age}} '
};
});
item
like so:
Live Demo