dart-archive / angular.dart

Legacy source repository. See github.com/dart-lang/angular
https://webdev.dartlang.org/angular/
1.25k stars 248 forks source link

AngularDart exceptions when served from non root url (localhost:8080/myApp/ vs localhost:8080/) #1601

Open mulander opened 10 years ago

mulander commented 10 years ago

Deploying an angular app as a statically served set of files from anywhere except the root url (http://host/ vs http://host/appname/) causes AngularDart to spew exceptions both when run from Dartium & from dart2js - both in debug and release modes).

The application uses:

None of the listed exceptions occur if the application is run from the root URL (in all modes, including dart2js).

I noticed that 'Missing getter: (o) => o.myapp' the part o.myapp will always match the folder name so:

http://localhost:8080/myapp/ = Missing getter: (o) => o.myapp
http://localhost:8080/test/ = Missing getter: (o) => o.test
etc...

Even with the exceptions:

The following exceptions are raised in case of my app:

Missing getter: (o) => o.myapp

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._addEvalWatch (package:angular/change_detection/watch_group.dart:235:52)
#6      WatchGroup.addFunctionWatch (package:angular/change_detection/watch_group.dart:199:20)
#7      PureFunctionAST.setupWatch (package:angular/change_detection/ast.dart:88:34)
#8      WatchGroup.watch (package:angular/change_detection/watch_group.dart:141:62)
#9      Scope.watchAST (package:angular/core/scope.dart:271:23)
#10     ElementBinder._bindTwoWay (package:angular/core_dom/element_binder.dart:92:19)
#11     ElementBinder._createAttrMappings (package:angular/core_dom/element_binder.dart:171:22)
#12     ElementBinder._link (package:angular/core_dom/element_binder.dart:226:30)
#13     ElementBinder.bind (package:angular/core_dom/element_binder.dart:310:10)
#14     ViewFactory._bindTagged (package:angular/core_dom/view_factory.dart:79:36)
#15     ViewFactory._link (package:angular/core_dom/view_factory.dart:119:24)
#16     ViewFactory.call (package:angular/core_dom/view_factory.dart:58:10)
#17     NgView._show.<anonymous closure> (package:angular/routing/ng_view.dart:124:26)
#18     _rootRunUnary (dart:async/zone.dart:899)
#19     _ZoneDelegate.runUnary (dart:async/zone.dart:506)
#20     _onRunUnary.<anonymous closure> (package:angular/core/zone.dart:122:63)
#21     VmTurnZone._onRunBase (package:angular/core/zone.dart:104:16)
#22     _onRunUnary (package:angular/core/zone.dart:122:17)
#23     _CustomZone.runUnary (dart:async/zone.dart:801)
#24     _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:496)
#25     _Future._propagateToListeners (dart:async/future_impl.dart:579)
#26     _Future._completeWithValue (dart:async/future_impl.dart:339)
#27     _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:401)
#28     _rootRun (dart:async/zone.dart:888)
#29     _ZoneDelegate.run (dart:async/zone.dart:499)
#30     _onScheduleMicrotask.<anonymous closure> (package:angular/core/zone.dart:127:45)
#31     RootScope._runAsyncFns (package:angular/core/scope.dart:923:25)
#32     RootScope.digest (package:angular/core/scope.dart:812:38)
#33     Scope.apply (package:angular/core/scope.dart:316:24)
#34     RootScope.RootScope.<anonymous closure> (package:angular/core/scope.dart:768:12)
#35     _rootRun (dart:async/zone.dart:892)
#36     _ZoneDelegate.run (dart:async/zone.dart:499)
#37     VmTurnZone._finishTurn (package:angular/core/zone.dart:168:21)
#38     VmTurnZone._onRunBase (package:angular/core/zone.dart:111:43)
#39     _onRunUnary (package:angular/core/zone.dart:122:17)
#40     _CustomZone.runUnary (dart:async/zone.dart:801)
#41     _CustomZone.runUnaryGuarded (dart:async/zone.dart:709)
#42     _CustomZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:735)

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

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

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.<anonymous closure> (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.<anonymous closure> (dart:async/zone.dart:735)

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

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

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: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.<anonymous closure> (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.<anonymous closure> (dart:async/zone.dart:735)
tptodorov commented 10 years ago

I have the same problem. Some getters are found and others not. It seems it depends on the getter name somehow.

naomiblack commented 9 years ago

@rkirov can you please point to more info on transformers and why this issue happens for folks? This seems to be a common area of confusion.

rkirov commented 9 years ago

Here is a quick overview of the angular transformer - https://github.com/angular/angular.dart/wiki/The-Angular-Transformer.

Sounds like the expression extractor transformer is not successful for you. Do you see errors of the type Unable to find ... at ... during pub build or pub serve?

Try rewriting your templateUrls to package absolute ones like this packages/my_package/path_to_my_template.