Skip to content
This repository has been archived by the owner on Feb 22, 2018. It is now read-only.

Element attributes not mapped with NgAnnotation.TRANSCLUDE_CHILDREN #531

Open
angular-dart-ui opened this issue Feb 9, 2014 · 6 comments
Milestone

Comments

@angular-dart-ui
Copy link

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.

@mhevery mhevery added this to the 0.9.8 milestone Feb 12, 2014
@mhevery mhevery self-assigned this Feb 12, 2014
@mhevery
Copy link
Contributor

mhevery commented Feb 12, 2014

This whole template directive thing needs to be refactored.

@mhevery mhevery modified the milestones: Compiler Refactoring, 0.9.8 Feb 13, 2014
@ufoscout
Copy link

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?

@mhevery
Copy link
Contributor

mhevery commented Feb 19, 2014

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

@zoechi
Copy link
Contributor

zoechi commented Feb 19, 2014

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

@ufoscout
Copy link

@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'

@zoechi
Copy link
Contributor

zoechi commented Feb 19, 2014

Thanks, each day something new!
On Feb 19, 2014 8:45 PM, "Francesco" notifications@github.com 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//issues/531#issuecomment-35539757
.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

4 participants