angular.dart
angular.dart copied to clipboard
Wierd missing getter message with a simple component
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
This is a fairly common issue. @rkirov can you please point to a discussion for more context?
Thank you for help :)
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.
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.