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

Wierd missing getter message with a simple component

Open devmetal opened this issue 11 years ago • 4 comments

Hi, this is the component what i use:

library navbar;

import 'package:angular/angular.dart';

@Component(
    selector: 'btnavbar',
    templateUrl:'navbar.html',
    useShadowDom:false)
class BtNavbar {
  List<MenuItem> menuItems = <MenuItem>[
    new MenuItem("#not","working"),
    new MenuItem("#not","working")
  ];
}

class MenuItem {
  final String target;
  final String label;
  const MenuItem(this.target, this.label);
}

And this is the template:

<nav class="navbar navbar-default" role="navigation">
  <div class="container-fluid">

    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="#">
        <i class="fa fa-shopping-cart"></i>
      </a>
    </div>

    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav">
        <li ng-repeat="menuItem in menuItems">
          <a href="{{menuItem.target}}">{{menuItem.label}}</a>
        </li>
      </ul>
    </div>
  </div>
</nav>

The output is: Missing getter: (o) => o.menuItems

STACKTRACE: #0 StaticFieldGetterFactory.getter (package:angular/change_detection/dirty_checking_change_detector_static.dart:12:25) #1 DirtyCheckingRecord.object= (package:angular/change_detection/dirty_checking_change_detector.dart:545:43) #2 _FieldHandler.acceptValue (package:angular/change_detection/watch_group.dart:631:17) #3 WatchGroup.addFieldWatch (package:angular/change_detection/watch_group.dart:167:29) #4 FieldReadAST.setupWatch (package:angular/change_detection/ast.dart:68:31) #5 WatchGroup.addCollectionWatch (package:angular/change_detection/watch_group.dart:176:49) #6 CollectionAST.setupWatch (package:angular/change_detection/ast.dart:139:36) #7 WatchGroup.watch (package:angular/change_detection/watch_group.dart:141:62) #8 Scope.watchAST (package:angular/core/scope.dart:271:23) #9 Scope.watch (package:angular/core/scope.dart:259:28) #10 NgRepeat.expression= (package:angular/directive/ng_repeat.dart:129:26) #11 setters. (http://localhost:8080/main_static_expressions.dart:161:30) #12 ClosureMapLocalsAware.lookupSetter. (package:angular/core/parser/parser.dart:230:20) #13 AccessScope&AccessFast._assign (package:angular/core/parser/eval_access.dart:60:20) #14 AccessScopeFast.assign (package:angular/core/parser/eval_access.dart:16:34) #15 _UnwrapExceptionDecorator.assign (package:angular/core/parser/parser.dart:125:32) #16 ElementBinder._createAttrMappings. (package:angular/core_dom/element_binder.dart:161:36) #17 _AnchorAttrs.observe (package:angular/core_dom/view_factory.dart:240:13) #18 ElementBinder._createAttrMappings (package:angular/core_dom/element_binder.dart:160:28) #19 ElementBinder._link (package:angular/core_dom/element_binder.dart:226:30) #20 ElementBinder.bind (package:angular/core_dom/element_binder.dart:310:10) #21 ViewFactory._bindTagged (package:angular/core_dom/view_factory.dart:93:31) #22 ViewFactory._link (package:angular/core_dom/view_factory.dart:119:24) #23 ViewFactory.call (package:angular/core_dom/view_factory.dart:58:10) #24 BoundTranscludingComponentFactory.call.. (package:angular/core_dom/transcluding_component_factory.dart:112:54) #25 _rootRunUnary (dart:async/zone.dart:899) #26 _ZoneDelegate.runUnary (dart:async/zone.dart:506) #27 _onRunUnary. (package:angular/core/zone.dart:122:63) #28 VmTurnZone._onRunBase (package:angular/core/zone.dart:104:16) #29 _onRunUnary (package:angular/core/zone.dart:122:17) #30 _CustomZone.runUnary (dart:async/zone.dart:801) #31 _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:496) #32 _Future._propagateToListeners (dart:async/future_impl.dart:579) #33 _Future._propagateMultipleListeners (dart:async/future_impl.dart:431) #34 _Future._propagateToListeners (dart:async/future_impl.dart:458) #35 _Future._completeWithValue (dart:async/future_impl.dart:339) #36 _Future._asyncComplete. (dart:async/future_impl.dart:401) #37 _rootRun (dart:async/zone.dart:888) #38 _ZoneDelegate.run (dart:async/zone.dart:499) #39 _onScheduleMicrotask. (package:angular/core/zone.dart:127:45) #40 RootScope._runAsyncFns (package:angular/core/scope.dart:923:25) #41 RootScope.digest (package:angular/core/scope.dart:812:38) #42 Scope.apply (package:angular/core/scope.dart:316:24) #43 RootScope.RootScope. (package:angular/core/scope.dart:768:12) #44 _rootRun (dart:async/zone.dart:892) #45 _ZoneDelegate.run (dart:async/zone.dart:499) #46 VmTurnZone._finishTurn (package:angular/core/zone.dart:168:21) #47 VmTurnZone._onRunBase (package:angular/core/zone.dart:111:43) #48 _onRunUnary (package:angular/core/zone.dart:122:17) #49 _CustomZone.runUnary (dart:async/zone.dart:801) #50 _CustomZone.runUnaryGuarded (dart:async/zone.dart:709) #51 _CustomZone.bindUnaryCallback. (dart:async/zone.dart:735)

The null object does not have a method 'call'.

NoSuchMethodError: method not found: 'call' Receiver: null Arguments: [Instance of 'BtNavbar']

STACKTRACE: #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:45) #1 DirtyCheckingRecord.check (package:angular/change_detection/dirty_checking_change_detector.dart:569:26) #2 DirtyCheckingChangeDetector.collectChanges (package:angular/change_detection/dirty_checking_change_detector.dart:353:26) #3 RootWatchGroup.detectChanges (package:angular/change_detection/watch_group.dart:398:69) #4 RootScope.digest (package:angular/core/scope.dart:815:45) #5 Scope.apply (package:angular/core/scope.dart:316:24) #6 RootScope.RootScope. (package:angular/core/scope.dart:768:12) #7 _rootRun (dart:async/zone.dart:892) #8 _ZoneDelegate.run (dart:async/zone.dart:499) #9 VmTurnZone._finishTurn (package:angular/core/zone.dart:168:21) #10 VmTurnZone._onRunBase (package:angular/core/zone.dart:111:43) #11 _onRunUnary (package:angular/core/zone.dart:122:17) #12 _CustomZone.runUnary (dart:async/zone.dart:801) #13 _CustomZone.runUnaryGuarded (dart:async/zone.dart:709) #14 _CustomZone.bindUnaryCallback. (dart:async/zone.dart:735)

The null object does not have a method 'call'.

NoSuchMethodError: method not found: 'call' Receiver: null Arguments: [Instance of 'BtNavbar']

STACKTRACE: #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:45) #1 DirtyCheckingRecord.check (package:angular/change_detection/dirty_checking_change_detector.dart:569:26) #2 DirtyCheckingChangeDetector.collectChanges (package:angular/change_detection/dirty_checking_change_detector.dart:353:26) #3 RootWatchGroup.detectChanges (package:angular/change_detection/watch_group.dart:398:69) #4 RootScope.flush. (package:angular/core/scope.dart:879:58) #5 RootScope.flush (package:angular/core/scope.dart:896:9) #6 Scope.apply (package:angular/core/scope.dart:317:23) #7 RootScope.RootScope. (package:angular/core/scope.dart:768:12) #8 _rootRun (dart:async/zone.dart:892) #9 _ZoneDelegate.run (dart:async/zone.dart:499) #10 VmTurnZone._finishTurn (package:angular/core/zone.dart:168:21) #11 VmTurnZone._onRunBase (package:angular/core/zone.dart:111:43) #12 _onRunUnary (package:angular/core/zone.dart:122:17) #13 _CustomZone.runUnary (dart:async/zone.dart:801) #14 _CustomZone.runUnaryGuarded (dart:async/zone.dart:709) #15 _CustomZone.bindUnaryCallback. (dart:async/zone.dart:735)

The null object does not have a method 'call'.

NoSuchMethodError: method not found: 'call' Receiver: null Arguments: [Instance of 'BtNavbar']

STACKTRACE: #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:45) #1 DirtyCheckingRecord.check (package:angular/change_detection/dirty_checking_change_detector.dart:569:26) #2 DirtyCheckingChangeDetector.collectChanges (package:angular/change_detection/dirty_checking_change_detector.dart:353:26) #3 RootWatchGroup.detectChanges (package:angular/change_detection/watch_group.dart:398:69) #4 RootScope.digest (package:angular/core/scope.dart:815:45) #5 Scope.apply (package:angular/core/scope.dart:316:24) #6 RootScope.RootScope. (package:angular/core/scope.dart:768:12) #7 _rootRun (dart:async/zone.dart:892) #8 _ZoneDelegate.run (dart:async/zone.dart:499) #9 VmTurnZone._finishTurn (package:angular/core/zone.dart:168:21) #10 VmTurnZone._onRunBase (package:angular/core/zone.dart:111:43) #11 _onRunUnary (package:angular/core/zone.dart:122:17) #12 _CustomZone.runUnary (dart:async/zone.dart:801) #13 _CustomZone.runUnaryGuarded (dart:async/zone.dart:709) #14 _CustomZone.bindUnaryCallback. (dart:async/zone.dart:735)

The null object does not have a method 'call'.

NoSuchMethodError: method not found: 'call' Receiver: null Arguments: [Instance of 'BtNavbar']

STACKTRACE: #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:45) #1 DirtyCheckingRecord.check (package:angular/change_detection/dirty_checking_change_detector.dart:569:26) #2 DirtyCheckingChangeDetector.collectChanges (package:angular/change_detection/dirty_checking_change_detector.dart:353:26) #3 RootWatchGroup.detectChanges (package:angular/change_detection/watch_group.dart:398:69) #4 RootScope.digest (package:angular/core/scope.dart:815:45) #5 Scope.apply (package:angular/core/scope.dart:316:24) #6 RootScope.RootScope. (package:angular/core/scope.dart:768:12) #7 _rootRun (dart:async/zone.dart:892) #8 _ZoneDelegate.run (dart:async/zone.dart:499) #9 VmTurnZone._finishTurn (package:angular/core/zone.dart:168:21) #10 VmTurnZone._onRunBase (package:angular/core/zone.dart:111:43) #11 _onRunUnary (package:angular/core/zone.dart:122:17) #12 _CustomZone.runUnary (dart:async/zone.dart:801) #13 _CustomZone.runUnaryGuarded (dart:async/zone.dart:709) #14 _CustomZone.bindUnaryCallback. (dart:async/zone.dart:735)

The null object does not have a method 'call'.

NoSuchMethodError: method not found: 'call' Receiver: null Arguments: [Instance of 'BtNavbar']

STACKTRACE: #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:45) #1 DirtyCheckingRecord.check (package:angular/change_detection/dirty_checking_change_detector.dart:569:26) #2 DirtyCheckingChangeDetector.collectChanges (package:angular/change_detection/dirty_checking_change_detector.dart:353:26) #3 RootWatchGroup.detectChanges (package:angular/change_detection/watch_group.dart:398:69) #4 RootScope.flush. (package:angular/core/scope.dart:879:58) #5 RootScope.flush (package:angular/core/scope.dart:896:9) #6 Scope.apply (package:angular/core/scope.dart:317:23) #7 RootScope.RootScope. (package:angular/core/scope.dart:768:12) #8 _rootRun (dart:async/zone.dart:892) #9 _ZoneDelegate.run (dart:async/zone.dart:499) #10 VmTurnZone._finishTurn (package:angular/core/zone.dart:168:21) #11 VmTurnZone._onRunBase (package:angular/core/zone.dart:111:43) #12 _onRunUnary (package:angular/core/zone.dart:122:17) #13 _CustomZone.runUnary (dart:async/zone.dart:801) #14 _CustomZone.runUnaryGuarded (dart:async/zone.dart:709) #15 _CustomZone.bindUnaryCallback. (dart:async/zone.dart:735)

The null object does not have a method 'call'.

NoSuchMethodError: method not found: 'call' Receiver: null Arguments: [Instance of 'BtNavbar']

STACKTRACE: #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:45) #1 DirtyCheckingRecord.check (package:angular/change_detection/dirty_checking_change_detector.dart:569:26) #2 DirtyCheckingChangeDetector.collectChanges (package:angular/change_detection/dirty_checking_change_detector.dart:353:26) #3 RootWatchGroup.detectChanges (package:angular/change_detection/watch_group.dart:398:69) #4 RootScope.digest (package:angular/core/scope.dart:815:45) #5 Scope.apply (package:angular/core/scope.dart:316:24) #6 RootScope.RootScope. (package:angular/core/scope.dart:768:12) #7 _rootRun (dart:async/zone.dart:892) #8 _ZoneDelegate.run (dart:async/zone.dart:499) #9 VmTurnZone._finishTurn (package:angular/core/zone.dart:168:21) #10 VmTurnZone._onRunBase (package:angular/core/zone.dart:111:43) #11 _onRunUnary (package:angular/core/zone.dart:122:17) #12 _CustomZone.runUnary (dart:async/zone.dart:801) #13 _CustomZone.runUnaryGuarded (dart:async/zone.dart:709) #14 _CustomZone.bindUnaryCallback. (dart:async/zone.dart:735)

The null object does not have a method 'call'.

NoSuchMethodError: method not found: 'call' Receiver: null Arguments: [Instance of 'BtNavbar']

STACKTRACE: #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:45) #1 DirtyCheckingRecord.check (package:angular/change_detection/dirty_checking_change_detector.dart:569:26) #2 DirtyCheckingChangeDetector.collectChanges (package:angular/change_detection/dirty_checking_change_detector.dart:353:26) #3 RootWatchGroup.detectChanges (package:angular/change_detection/watch_group.dart:398:69) #4 RootScope.digest (package:angular/core/scope.dart:815:45) #5 Scope.apply (package:angular/core/scope.dart:316:24) #6 RootScope.RootScope. (package:angular/core/scope.dart:768:12) #7 _rootRun (dart:async/zone.dart:892) #8 _ZoneDelegate.run (dart:async/zone.dart:499) #9 VmTurnZone._finishTurn (package:angular/core/zone.dart:168:21) #10 VmTurnZone._onRunBase (package:angular/core/zone.dart:111:43) #11 _onRunUnary (package:angular/core/zone.dart:122:17) #12 _CustomZone.runUnary (dart:async/zone.dart:801) #13 _CustomZone.runUnaryGuarded (dart:async/zone.dart:709) #14 _CustomZone.bindUnaryCallback. (dart:async/zone.dart:735)

The null object does not have a method 'call'.

NoSuchMethodError: method not found: 'call' Receiver: null Arguments: [Instance of 'BtNavbar']

STACKTRACE: #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:45) #1 DirtyCheckingRecord.check (package:angular/change_detection/dirty_checking_change_detector.dart:569:26) #2 DirtyCheckingChangeDetector.collectChanges (package:angular/change_detection/dirty_checking_change_detector.dart:353:26) #3 RootWatchGroup.detectChanges (package:angular/change_detection/watch_group.dart:398:69) #4 RootScope.flush. (package:angular/core/scope.dart:879:58) #5 RootScope.flush (package:angular/core/scope.dart:896:9) #6 Scope.apply (package:angular/core/scope.dart:317:23) #7 RootScope.RootScope. (package:angular/core/scope.dart:768:12) #8 _rootRun (dart:async/zone.dart:892) #9 _ZoneDelegate.run (dart:async/zone.dart:499) #10 VmTurnZone._finishTurn (package:angular/core/zone.dart:168:21) #11 VmTurnZone._onRunBase (package:angular/core/zone.dart:111:43) #12 _onRunUnary (package:angular/core/zone.dart:122:17) #13 _CustomZone.runUnary (dart:async/zone.dart:801) #14 _CustomZone.runUnaryGuarded (dart:async/zone.dart:709) #15 _CustomZone.bindUnaryCallback. (dart:async/zone.dart:735)

The null object does not have a method 'call'.

NoSuchMethodError: method not found: 'call' Receiver: null Arguments: [Instance of 'BtNavbar']

STACKTRACE: #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:45) #1 DirtyCheckingRecord.check (package:angular/change_detection/dirty_checking_change_detector.dart:569:26) #2 DirtyCheckingChangeDetector.collectChanges (package:angular/change_detection/dirty_checking_change_detector.dart:353:26) #3 RootWatchGroup.detectChanges (package:angular/change_detection/watch_group.dart:398:69) #4 RootScope.digest (package:angular/core/scope.dart:815:45) #5 Scope.apply (package:angular/core/scope.dart:316:24) #6 RootScope.RootScope. (package:angular/core/scope.dart:768:12) #7 _rootRun (dart:async/zone.dart:892) #8 _ZoneDelegate.run (dart:async/zone.dart:499) #9 VmTurnZone._finishTurn (package:angular/core/zone.dart:168:21) #10 VmTurnZone._onRunBase (package:angular/core/zone.dart:111:43) #11 _onRunUnary (package:angular/core/zone.dart:122:17) #12 _CustomZone.runUnary (dart:async/zone.dart:801) #13 _CustomZone.runUnaryGuarded (dart:async/zone.dart:709) #14 _CustomZone.bindUnaryCallback. (dart:async/zone.dart:735)

The null object does not have a method 'call'.

NoSuchMethodError: method not found: 'call' Receiver: null Arguments: [Instance of 'BtNavbar']

STACKTRACE: #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:45) #1 DirtyCheckingRecord.check (package:angular/change_detection/dirty_checking_change_detector.dart:569:26) #2 DirtyCheckingChangeDetector.collectChanges (package:angular/change_detection/dirty_checking_change_detector.dart:353:26) #3 RootWatchGroup.detectChanges (package:angular/change_detection/watch_group.dart:398:69) #4 RootScope.digest (package:angular/core/scope.dart:815:45) #5 Scope.apply (package:angular/core/scope.dart:316:24) #6 RootScope.RootScope. (package:angular/core/scope.dart:768:12) #7 _rootRun (dart:async/zone.dart:892) #8 _ZoneDelegate.run (dart:async/zone.dart:499) #9 VmTurnZone._finishTurn (package:angular/core/zone.dart:168:21) #10 VmTurnZone._onRunBase (package:angular/core/zone.dart:111:43) #11 _onRunUnary (package:angular/core/zone.dart:122:17) #12 _CustomZone.runUnary (dart:async/zone.dart:801) #13 _CustomZone.runUnaryGuarded (dart:async/zone.dart:709) #14 _CustomZone.bindUnaryCallback. (dart:async/zone.dart:735)

The null object does not have a method 'call'.

NoSuchMethodError: method not found: 'call' Receiver: null Arguments: [Instance of 'BtNavbar']

STACKTRACE: #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:45) #1 DirtyCheckingRecord.check (package:angular/change_detection/dirty_checking_change_detector.dart:569:26) #2 DirtyCheckingChangeDetector.collectChanges (package:angular/change_detection/dirty_checking_change_detector.dart:353:26) #3 RootWatchGroup.detectChanges (package:angular/change_detection/watch_group.dart:398:69) #4 RootScope.flush. (package:angular/core/scope.dart:879:58) #5 RootScope.flush (package:angular/core/scope.dart:896:9) #6 Scope.apply (package:angular/core/scope.dart:317:23) #7 RootScope.RootScope. (package:angular/core/scope.dart:768:12) #8 _rootRun (dart:async/zone.dart:892) #9 _ZoneDelegate.run (dart:async/zone.dart:499) #10 VmTurnZone._finishTurn (package:angular/core/zone.dart:168:21) #11 VmTurnZone._onRunBase (package:angular/core/zone.dart:111:43) #12 _onRunUnary (package:angular/core/zone.dart:122:17) #13 _CustomZone.runUnary (dart:async/zone.dart:801) #14 _CustomZone.runUnaryGuarded (dart:async/zone.dart:709) #15 _CustomZone.bindUnaryCallback. (dart:async/zone.dart:735)

I don't get what is the problem. This is a simple list, and a simple ng-repeat.

My index.html like this:

<!DOCTYPE html>
<html ng-app>
  <head>
    <title>DartShop</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link rel="stylesheet" href="css/dartshop.css">
    <link rel="stylesheet" href="packages/angular/css/angular.css">
    <script src="packages/web_components/platform.js"></script>
    <script src="packages/web_components/dart_support.js"></script>
  </head>
  <body>

    <btnavbar></btnavbar>
    <dart-shop ng-cloack></dart-shop>

    <script type="application/dart" src="main.dart"></script>
    <script type="text/javascript" src="packages/browser/dart.js"></script>
    <script type="text/javascript" src="js/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" src="js/bootstrap.min.js"></script>
  </body>
</html>

This is a tutorial project, to my blog, but i had so many issues and frustrating problems.

devmetal avatar Nov 26 '14 23:11 devmetal

This is a fairly common issue. @rkirov can you please point to a discussion for more context?

naomiblack avatar Dec 09 '14 22:12 naomiblack

Thank you for help :)

devmetal avatar Dec 10 '14 12:12 devmetal

I wrote some info on how transformers work here - https://github.com/angular/angular.dart/wiki/The-Angular-Transformer

Long story short - missing getter is a sign that the expression transformer did not do its job correctly. The source of the issue is how is templateUrl:'navbar.html' interpreted. While you write it as relative to the current dart file, the transformer looks it up relative to the package root. Replace it with the more explicit packages/<my_package>/navbar.html which should satisfy both the expression extractor and pub serve.

rkirov avatar Dec 13 '14 03:12 rkirov

This is a pretty old thread, but I am having the exact problem. I'm beginning to think there is a reason Google switched to TypeScript.

moworld avatar Jan 05 '16 20:01 moworld