New to Angular but enjoying it very much! I'm hoping the experts of this 
community can help me with an issue I'm having with a parent and child 
directives.

Essentially I need a directive (Item) that can accept a caption either as a 
attribute or element. The reason for this is so I can furnish captions 
containing HTML.

Here's some code:

.directive('item', ['$parse', function($parse) {
  return {
    restrict: 'E',
    replace: true,
    templateUrl: '/path/to/template.html',
    transclude: true,
    scope: {
      caption: '='
    },

    controller: function() { },
    link: function (scope, elm, attrs, ctrl) {
    }
  };

}])

.directive('itemCaption', function() {
  return {
    restrict: 'E',
    require: '^item',
    link: function(scope, el, attrs, ctrl, transfn) {
    }

  };
})

I've got the caption working when it's given as an attribute but not when 
it is specified as an element. In particular, I need the descendant 
contents of itemCaption to be appended to the parent item (so, without the 
item-caption tag).

How can I achieve this?

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to