Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

feat(directives): remove the @Controller directive #1401

Closed
wants to merge 1 commit into from

Conversation

rkirov
Copy link
Contributor

@rkirov rkirov commented Aug 27, 2014

Completely remove the deprecated Controller directive. Update the
demos to use setRootContext.

Pulled out of the first commit in #1269.

@vicb
Copy link
Contributor

vicb commented Aug 28, 2014

NGTM, tests fail

@rkirov rkirov force-pushed the rm-ctrl branch 2 times, most recently from cc1788b to 754ef65 Compare August 29, 2014 18:06
@@ -0,0 +1,127 @@
import 'package:angular/angular.dart';
Copy link
Contributor

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 ?

Copy link
Contributor Author

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.

Copy link
Contributor

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 ?

Copy link
Contributor Author

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?

Copy link
Contributor

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 ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lib/tools/transformer

Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor

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 ?

Copy link
Contributor Author

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.

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.
@rkirov rkirov assigned mhevery and unassigned vicb Sep 2, 2014
rkirov added a commit that referenced this pull request Sep 2, 2014
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
@rkirov rkirov closed this in 5f8e276 Sep 3, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

3 participants