-
Notifications
You must be signed in to change notification settings - Fork 248
feat(directives): remove the @Controller directive #1401
Conversation
NGTM, tests fail |
cc1788b
to
754ef65
Compare
@@ -0,0 +1,127 @@ | |||
import 'package:angular/angular.dart'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do this end up the lib folder ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't get the getter extractor to extract the getter for 'ctrl' when it was in web. Basically, I copied the structure from the tutorial which I know works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you tried to list the html files in the pubpec.yaml ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, do you have an example?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like
transformers:
- angular
html_files:
- file1.html
- file2.htrm
But first we should wonder why it was working before and it is no more working, any idea ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lib/tools/transformer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and you can run pub build --mode=debug
so that transformed and generated dart files are not removed from the build folder, it might help with debugging
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, after hours of debugging, I think I have some understanding of how transformers work (and a few bugs to report to dart team).
expressions in @component(templateUrl: ) are resolved at transformation time starting with project root. So if I change it to 'web/bouncing_controller.html' transformer works, but now pub serve would not serve because it already start at /web.
Lib works because it gets moved to packages/angular_dart_demo which works both for transformer and pub serve.
So we should either fix the transformer before this commit, or put it in lib for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is one thing I don't get from your comment:
- On latest master the examples work,
- What change in this PR make them not work from the web folder ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, the examples don't use components. My PR extracts the controller code into a component, which means previously we had one big index.html, now we have index.html and component template html.
The way expression extractor works is that the entry points are all web/.dart files, from there we find all web/.html files that reference them (that's how index.html is picked up) and all templateUrl: are extracted from annotations and the right files are found (that's how packages/angular_demo_example/bouncing_controller.html is picked up).
The extractor has issues with relative paths as the extractor resolves relative to the package root, but the web server works relative to web/. @chirayuk is saying that this should be fixed very soon (so we can change this). On top of it there seems to be a bug in transformers which means the warning "file not found" doesn't get printed.
c7e9a2b
to
7baf163
Compare
Completely remove the deprecated Controller directive. Major update to the demos to use setRootContext (where applicable) and to move to Components for the beefier demos (bouncing balls and form). A temporary work around was required in demos (animation and todo) so that rootContext have Map interface. The work arounds will disappear after the context is set to the component. Library changes were pulled out of the first commit in dart-archive#1269.
Completely remove the deprecated Controller directive. Major update to the demos to use setRootContext (where applicable) and to move to Components for the beefier demos (bouncing balls and form). A temporary work around was required in demos (animation and todo) so that rootContext have Map interface. The work arounds will disappear after the context is set to the component. Library changes were pulled out of the first commit in #1269. Closes #1401
Completely remove the deprecated Controller directive. Update the
demos to use setRootContext.
Pulled out of the first commit in #1269.