This repository was archived by the owner on Feb 22, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 216
This repository was archived by the owner on Feb 22, 2018. It is now read-only.
exportExpressions doesn't work on controllers #1308
Copy link
Copy link
Closed
Description
The exportExpressions parameter of Directive only works for Component and Decorator but not for Controller. In the example below this means that running the transformed js code throws:
No getter for 'foo'.
STACKTRACE:
Error
at dart.wrapException (http://localhost:8080/main.dart.js:2500:15)
at StaticClosureMap.lookupGetter$1 (http://localhost:8080/main.dart.js:10690:17)
at DynamicParserBackend.newAccessScope$1 (http://localhost:8080/main.dart.js:8929:21)
at DynamicParserImpl.parseAccessOrCallScope$0 (http://localhost:8080/main.dart.js:9283:29)
at DynamicParserImpl.parsePrimary$0 (http://localhost:8080/main.dart.js:9259:21)
at DynamicParserImpl.parseAccessOrCallMember$0 (http://localhost:8080/main.dart.js:9216:21)
at DynamicParserImpl.parsePrefix$0 (http://localhost:8080/main.dart.js:9212:21)
at DynamicParserImpl.parseMultiplicative$0 (http://localhost:8080/main.dart.js:9191:21)
at DynamicParserImpl.parseAdditive$0 (http://localhost:8080/main.dart.js:9180:21)
at DynamicParserImpl.parseRelational$0 (http://localhost:8080/main.dart.js:9165:21)
If I change the annotation on FoobarController from Controller to Decorator the example works and prints 'bar' in the console as expected.
Issue was spun from this discussion.
pubspec.yaml
name: test
version: 0.0.1
dependencies:
angular: 0.13.0
browser: any
transformers:
- angular:
html_files:
- web/index.html
index.html
<!DOCTYPE html>
<html ng-app>
<body>
<div foobar></div>
<script type="application/dart" src="main.dart"></script>
<script type="text/javascript" src="packages/browser/dart.js"></script>
</body>
</html>
main.dart
import 'package:angular/angular.dart';
import 'package:angular/application_factory.dart';
void main() {
applicationFactory()
.addModule(new Module()
..bind(FooWatcher)
..bind(FoobarController))
.run();
}
@Injectable()
class FooWatcher {
Scope _scope;
FooWatcher(this._scope);
watch(foo) {
_scope.createChild(foo)
.watch('foo', (newValue, oldValue) => print(newValue));
}
}
@Controller(selector: '[foobar]',
exportExpressions: const ['foo'])
class FoobarController {
FoobarController(FooWatcher watcher) {
watcher.watch(this);
}
var foo = 'bar';
}
Metadata
Metadata
Assignees
Labels
No labels