angular.dart icon indicating copy to clipboard operation
angular.dart copied to clipboard

Element attributes not mapped with NgAnnotation.TRANSCLUDE_CHILDREN

Open angular-dart-ui opened this issue 11 years ago • 6 comments

Attributes declared in map of NgDirectives are ignored if 'children' is set as NgAnnotation.TRANSCLUDE_CHILDREN. E.g.:

Dart code:

@NgDirective(
    children: NgAnnotation.TRANSCLUDE_CHILDREN,
    selector:'[test-transclude]',
    map: const {
      '.': '=>dot',
      'test': '=>test'
    })
class TestTransclude {
  TestTransclude(BoundBlockFactory boundBlockFactory,
                BlockHole blockHole,
                Scope scope);

  set dot(value) {
    print('set dot: ' + value.toString());
  }
  set test(value) {
    print('set test: ' + value.toString());
  }
}

HTML:

<div test-transclude="'fromDot'" test="'fromTest'"></div>

Wrong behaviour: only "set dot" is printed; Expected behaviour: both the set functions should be called.

We wrote a directive that reproduce the NgDirective with transclusion behaviour available in AngularJS; however, we would like to be able to map multiple attributes exactly as in AngularJS. NgComponent is not a good alternative because it uses the shadow dom.

angular-dart-ui avatar Feb 09 '14 00:02 angular-dart-ui

This whole template directive thing needs to be refactored.

mhevery avatar Feb 12 '14 21:02 mhevery

Hi Miško, thanks for your answer; however, it does not clarify what should we expect for this issue. Will it be fixed? Or does your answer mean that you plan to add template/templateUrl to the directive?

ufoscout avatar Feb 18 '14 21:02 ufoscout

Yes it will be refactored over the next month or so.

mhevery avatar Feb 19 '14 03:02 mhevery

May I ask what this '.': '=>dot', is supposed to do?

zoechi avatar Feb 19 '14 07:02 zoechi

@zoechi it maps the value of the element's attribute that matches the selector name, in this case "test-transclude", to a variable named "dot". It is a short cut for 'test-transclude': '=>dot'

ufoscout avatar Feb 19 '14 19:02 ufoscout

Thanks, each day something new! On Feb 19, 2014 8:45 PM, "Francesco" [email protected] wrote:

@zoechi https://github.com/zoechi it maps the value of the element's attribute that matches the selector name, in this case "test-transclude", to a variable named "dot". It is a short cut for 'test-transclude': '=>dot'

— Reply to this email directly or view it on GitHubhttps://github.com/angular/angular.dart/issues/531#issuecomment-35539757 .

zoechi avatar Feb 19 '14 19:02 zoechi