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

Web components and on-* syntax does not work properly #1434

Closed
tlvenn opened this issue Sep 8, 2014 · 2 comments
Closed

Web components and on-* syntax does not work properly #1434

tlvenn opened this issue Sep 8, 2014 · 2 comments

Comments

@tlvenn
Copy link

tlvenn commented Sep 8, 2014

Hi,

I am using angular 0.14 with paper elements and the on-* syntax simply does not work beyond a simple expression as it is in the example bundled with angular dart.

For example, I cant trigger a component method using the on-* syntax.

Let's say, i have a simple component published as cmp with the following template:

<paper-icon-button iconSrc="img/btn_menu.svg" on-click="cmp.openMenu"></paper-icon-button>

Whenever the button is pressed, the following error appears:

No getter for 'openMenu'.

STACKTRACE:
#0      StaticClosureMap.lookupGetter (package:angular/core/parser/static_closure_map.dart:15:25)
#1      DynamicParserBackend.newAccessScope (package:angular/core/parser/dynamic_parser.dart:112:38)
#2      DynamicParserImpl.parseAccessOrCallScope (package:angular/core/parser/dynamic_parser_impl.dart:257:67)
#3      DynamicParserImpl.parsePrimary (package:angular/core/parser/dynamic_parser_impl.dart:239:36)
#4      DynamicParserImpl.parseAccessOrCallMember (package:angular/core/parser/dynamic_parser_impl.dart:193:30)
#5      DynamicParserImpl.parsePrefix (package:angular/core/parser/dynamic_parser_impl.dart:188:37)
#6      DynamicParserImpl.parseMultiplicative (package:angular/core/parser/dynamic_parser_impl.dart:163:29)
#7      DynamicParserImpl.parseAdditive (package:angular/core/parser/dynamic_parser_impl.dart:149:37)
#8      DynamicParserImpl.parseRelational (package:angular/core/parser/dynamic_parser_impl.dart:131:31)
#9      DynamicParserImpl.parseEquality (package:angular/core/parser/dynamic_parser_impl.dart:117:33)
#10     DynamicParserImpl.parseLogicalAnd (package:angular/core/parser/dynamic_parser_impl.dart:108:31)
#11     DynamicParserImpl.parseLogicalOr (package:angular/core/parser/dynamic_parser_impl.dart:99:33)
#12     DynamicParserImpl.parseConditional (package:angular/core/parser/dynamic_parser_impl.dart:83:32)
#13     DynamicParserImpl.parseExpression (package:angular/core/parser/dynamic_parser_impl.dart:68:34)
#14     DynamicParserImpl.parseFormatter (package:angular/core/parser/dynamic_parser_impl.dart:53:33)
#15     DynamicParserImpl.parseChain (package:angular/core/parser/dynamic_parser_impl.dart:35:32)
#16     DynamicParser._parse (package:angular/core/parser/dynamic_parser.dart:40:46)
#17     DynamicParser.call.<anonymous closure> (package:angular/core/parser/dynamic_parser.dart:35:50)
#18     _HashMap.putIfAbsent (dart:collection-patch/collection_patch.dart:124)
#19     DynamicParser.call (package:angular/core/parser/dynamic_parser.dart:35:30)
#20     Scope.eval (package:angular/core/scope.dart:297:31)
#21     _eventListener (package:angular/core_dom/event_handler.dart:59:40)
#22     _rootRunUnary (dart:async/zone.dart:840)
#23     _ZoneDelegate.runUnary (dart:async/zone.dart:466)
#24     _onRunUnary.<anonymous closure> (package:angular/core/zone.dart:117:63)
#25     VmTurnZone._onRunBase (package:angular/core/zone.dart:99:16)
#26     _onRunUnary (package:angular/core/zone.dart:117:17)
#27     _CustomZone.runUnary (dart:async/zone.dart:748)
#28     _CustomZone.runUnaryGuarded (dart:async/zone.dart:656)
#29     _CustomZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:682)

Similarly, if I try the on-* syntax on a core-menu for example, such as :
<core-menu selected="0" on-core-select="cmp.selectAction">

Nothing happen when menu items are selected...

Am i missing something obvious ?
Thanks in advance for any help on this matter.

@rkirov
Copy link
Contributor

rkirov commented Sep 21, 2014

Sounds like the issue here is not with the on-*, but rather that openMenu getter is not extracted by the angular transformer. Might be a bug with the transformed but hard to tell before knowing more about the location of the template.

@tlvenn
Copy link
Author

tlvenn commented Sep 21, 2014

Hi @rkirov, the template for the component is in the same directory as the component itself.

The declaration is as below:

@Component(
    selector: 'main',
    publishAs: 'cmp',
    templateUrl: 'lib/components/main.html',
    useShadowDom: false
)

And i use a custom UrlRewriter as follow:

@Injectable()
class AppUrlRewriter implements UrlRewriter {
  String call(url) =>
      url.startsWith('lib/') ? 'packages/myapp/${url.substring(4)}' : url;
}

Let me know if you need more information. Thanks !

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

2 participants