Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have an Angular.Dart program and want to add some Angular functionality to the main program (outside of any components). I've been reading about how to accomplish this, and it seems that you have to use the .rootContextType property to accomplish this.

This is my main() function before I tried anything, and it's working fine:

main() {
  applicationFactory()
      .addModule(new MainInitModule())
      .run();
}

Next, I defined an empty class (to be my Root Controller) as follows:

 @Injectable()
 class RootController {

 }

And I modified my main() function as follows:

main() {
  applicationFactory()
      .rootContextType(RootController)
      .addModule(new MainInitModule())
      .run();
}

Trying to run this produce the following error messages / stack traces:

Missing getter: (o) => o.openAction

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._addEvalWatch (package:angular/change_detection/watch_group.dart:235:52)
#8      WatchGroup.addFunctionWatch (package:angular/change_detection/watch_group.dart:199:20)
#9      PureFunctionAST.setupWatch (package:angular/change_detection/ast.dart:88:34)
#10     WatchGroup.watch (package:angular/change_detection/watch_group.dart:141:62)
#11     Scope.watchAST (package:angular/core/scope.dart:271:23)
#12     AttrMustache.AttrMustache.<anonymous closure> (package:angular/core_dom/mustache.dart:38:32)
#13     NodeAttrs.listenObserverChanges (package:angular/core_dom/directive.dart:79:13)
#14     AttrMustache.AttrMustache (package:angular/core_dom/mustache.dart:34:33)
#15     ElementBinder._createDirectiveFactories (package:angular/core_dom/element_binder.dart:259:11)
#16     ElementBinder.bind (package:angular/core_dom/element_binder.dart:294:32)
#17     ViewFactory._bindTagged (package:angular/core_dom/view_factory.dart:79:36)
#18     ViewFactory._link (package:angular/core_dom/view_factory.dart:119:24)
#19     ViewFactory.call (package:angular/core_dom/view_factory.dart:58:10)
#20     Application.run.<anonymous closure>.<anonymous closure> (package:angular/application.dart:186:24)
#21     _rootRunUnary (dart:async/zone.dart:902)
#22     _ZoneDelegate.runUnary (dart:async/zone.dart:508)
#23     _onRunUnary.<anonymous closure> (package:angular/core/zone.dart:122:63)
#24     VmTurnZone._onRunBase (package:angular/core/zone.dart:104:16)
#25     _onRunUnary (package:angular/core/zone.dart:122:17)
#26     _CustomZone.runUnary (dart:async/zone.dart:804)
#27     _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:484)
#28     _Future._propagateToListeners (dart:async/future_impl.dart:567)
#29     _Future._completeWithValue (dart:async/future_impl.dart:358)
#30     _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:412)
#31     _rootRun (dart:async/zone.dart:895)
#32     _ZoneDelegate.run (dart:async/zone.dart:501)
#33     _onScheduleMicrotask.<anonymous closure> (package:angular/core/zone.dart:127:45)
#34     VmTurnZone._finishTurn (package:angular/core/zone.dart:166:34)
#35     VmTurnZone._onRunBase (package:angular/core/zone.dart:111:43)
#36     _onRun (package:angular/core/zone.dart:118:17)
#37     _CustomZone.run (dart:async/zone.dart:796)
#38     VmTurnZone.run (package:angular/core/zone.dart:257:40)
#39     Application.run (package:angular/application.dart:174:22)
#40     main (http://localhost:8080/datacea.dart:157:11)
#41     main (http://localhost:8080/datacea.html_bootstrap.dart:93:11)

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

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

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:860:38)
#5      Scope.apply (package:angular/core/scope.dart:317:23)
#6      RootScope.RootScope.<anonymous closure> (package:angular/core/scope.dart:768:12)
#7      _rootRun (dart:async/zone.dart:895)
#8      _ZoneDelegate.run (dart:async/zone.dart:501)
#9      VmTurnZone._finishTurn (package:angular/core/zone.dart:168:21)
#10     VmTurnZone._onRunBase (package:angular/core/zone.dart:111:43)
#11     _onRun (package:angular/core/zone.dart:118:17)
#12     _CustomZone.run (dart:async/zone.dart:796)
#13     VmTurnZone.run (package:angular/core/zone.dart:257:40)
#14     Application.run (package:angular/application.dart:174:22)
#15     main (http://localhost:8080/datacea.dart:157:11)
#16     main (http://localhost:8080/datacea.html_bootstrap.dart:93:11)

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

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

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.<anonymous closure> (package:angular/core/scope.dart:884:57)
#5      RootScope.flush (package:angular/core/scope.dart:896:9)
#6      Scope.apply (package:angular/core/scope.dart:317:23)
#7      RootScope.RootScope.<anonymous closure> (package:angular/core/scope.dart:768:12)
#8      _rootRun (dart:async/zone.dart:895)
#9      _ZoneDelegate.run (dart:async/zone.dart:501)
#10     VmTurnZone._finishTurn (package:angular/core/zone.dart:168:21)
#11     VmTurnZone._onRunBase (package:angular/core/zone.dart:111:43)
#12     _onRun (package:angular/core/zone.dart:118:17)
#13     _CustomZone.run (dart:async/zone.dart:796)
#14     VmTurnZone.run (package:angular/core/zone.dart:257:40)
#15     Application.run (package:angular/application.dart:174:22)
#16     main (http://localhost:8080/datacea.dart:157:11)
#17     main (http://localhost:8080/datacea.html_bootstrap.dart:93:11)

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

NoSuchMethodError: method not found: 'call'
Receiver: null
Arguments: [Instance of 'RootController'] (package:angular/change_detection/dirty_checking_change_detector.dart:569)

I've been racking my brain over how to resolve this for three days now with no success. Can anyone assist?

share|improve this question
    
There is no error in the code that you posted. Can you post the stack trace of the exception? –  Ozan Dec 31 '14 at 5:29
    
@Ozan - just added error / stack trace. –  Greg Sherman Dec 31 '14 at 5:36
    
There seems to be a reference to a openAction in a template somewhere. It can not be found in the scope and then these types of errors appear. –  Ozan Dec 31 '14 at 6:01
    
But everything is working perfectly prior to me adding the line ".rootContextType(RootController)" to main(). What gives? –  Greg Sherman Dec 31 '14 at 6:07
    
I don't understand it fully either. It seems that after adding a rootContextType Angular looks for openAction in there, unsuccessfully. –  Ozan Dec 31 '14 at 6:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.