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

Remove NgController and replace with applicationFactory root object #919

Closed
mhevery opened this issue Apr 16, 2014 · 21 comments
Closed

Remove NgController and replace with applicationFactory root object #919

mhevery opened this issue Apr 16, 2014 · 21 comments

Comments

@mhevery
Copy link
Contributor

mhevery commented Apr 16, 2014

NgController only makes sense for the top-most scope since there is not an implicit component. All children are created in a form of a component which has its own Controller per #914. Because NgController relies on publishAs it is not compatible with the #914 change. So we can bypass this by moving it to applicationFactory

applicationFactory()
  ..rootContextType(HelloWorld)
  ..run();

This is essentially equivalent to

applicationFactory()
  ..module(new Module()..type(Object, HelloWorld))
  ..run();

This way the RootScope's context is set to HelloWorld instance.

@mhevery mhevery added this to the Controller is Context milestone Apr 16, 2014
adarshaj referenced this issue Apr 18, 2014
Closes #902

BREAKING CHANGE:
  - Concepts:
    - Filter                        -> Formatter

  - import:
    - angular/directive/ng_a.dart   -> angular/directive/a_href.dart
    - angular/filter/currency.dart  -> angular/formatter/currency.dart
    - angular/filter/date.dart      -> angular/formatter/date.dart
    - angular/filter/filter.dart    -> angular/formatter/filter.dart
    - angular/filter/json.dart      -> angular/formatter/json.dart
    - angular/filter/limit_to.dart  -> angular/formatter/limit_to.dart
    - angular/filter/lowercase.dart -> angular/formatter/lowercase.dart
    - angular/filter/module.dart    -> angular/formatter/module.dart
    - angular/filter/number.dart    -> angular/formatter/number.dart
    - angular/filter/order_by.dart  -> angular/formatter/order_by.dart
    - angular/filter/stringify.dart -> angular/formatter/stringify.dart
    - angular/filter/uppercase.dart -> angular/formatter/uppercase.dart

  - Types:
    - NgA                           -> AHref
    - NgAttachAware                 -> AttachAware
    - NgDetachAware                 -> DetachAware
    - NgShadowRootAware             -> ShadowRootAware
    - NgFilter                      -> Formatter
    - NgInjectableService           -> Injectable
    - AbstractNgAnnotation          -> Directive
    - AbstractNgFieldAnnotation     -> DirectiveAnnotation
    - NgComponent                   -> Component
    - NgController                  -> Controller
    - NgDirective                   -> Decorator
    - NgAnimate                     -> Animate
    - NgZone                        -> VmTurnZone
    - NgAnimationModule             -> AnimationModule
    - NgCoreModule                  -> CoreModule
    - NgCoreDomModule               -> CoreDomModule
    - NgAnimationDirective          -> NgAnimation
    - NgAnimationChildrenDirective  -> NgAnimationChildren
    - FilterMap                     -> FormatterMap
    - NgAttrMustacheDirective       -> AttrMustache
    - NgTextMustacheDirective       -> TextMustache

  - Constants
    - NgDirective.LOCAL_VISIBILITY           -> Directive.LOCAL_VISIBILITY
    - NgDirective.CHILDREN_VISIBILITY        -> Directive.CHILDREN_VISIBILITY
    - NgDirective.DIRECT_CHILDREN_VISIBILITY -> Directive.DIRECT_CHILDREN_VISIBILITY
@zoechi
Copy link
Contributor

zoechi commented Apr 19, 2014

So in future Angular applications a controller can only be the root controller or a component, is that right?

I don't have yet enough experience with Angular to be able to tell if this is an advantage or disadvantage.

Somehow I found it liberating that in Angular not everything has to be a component when I started working with Angular after working 4 months with Polymer. Of course there are still directives but somehow this seems to restrict Angulars flexibiltiy.

Can you please explain the reasoning behind this decision a bit?

@mhevery
Copy link
Contributor Author

mhevery commented Apr 23, 2014

ng-controller have some weird semantics, and always felt like the odd man out. ng-controller is only useful outside of component, and nesting them has issues, so you usually have only one.

Removing it simplifies the world. The issue is that it makes hello world kinds of apps more complicated, but that will be solved by allowing the root of the app to have its own type and one would get best of all worlds.

The issue that everything has to be a component only feels like an issue if the cost of creating them is high. If you have light weight components with decorator-directives then you have all the tools you should need for building your app.

@zoechi
Copy link
Contributor

zoechi commented Apr 23, 2014

Thanks a lot for this feedback!

There were already several questions on SO and Google groups. I'll add a link to this thread.

vicb added a commit to vicb/angular.dart that referenced this issue May 13, 2014
closes dart-archive#919
closes dart-archive#917

It is possible to define the context of the root scope with:

applicationFactory()
..rootContextType(RootContext)
..run();

The RootContext need not be annotated with a directive.
vicb added a commit to vicb/angular.dart that referenced this issue May 13, 2014
closes dart-archive#919
closes dart-archive#917

It is possible to define the context of the root scope with:

applicationFactory()
..rootContextType(RootContext)
..run();

The RootContext need not be annotated with a directive.
vicb added a commit to vicb/angular.dart that referenced this issue May 13, 2014
closes dart-archive#919
closes dart-archive#917

It is possible to define the context of the root scope with:

applicationFactory()
..rootContextType(RootContext)
..run();

The RootContext need not be annotated with a directive.
vicb added a commit to vicb/angular.dart that referenced this issue May 15, 2014
closes dart-archive#919
closes dart-archive#917

1) The @controller annotation is no more

It is possible to define the context of the root scope with:

    applicationFactory()
        ..rootContextType(RootContext)
        ..run();

The RootContext needs to be annotated with @Injectable():

    @Injectable()
    class RootContext {
      // ...
    }

2) You can not inject a scope in a component or in theroot context any
more

As the Scope context is set to the Component instance, the scope could
not be injected any more. Components should implements the "ScopeAware"
interface and declare a "scope" setter in order to get hold of the
scope.

before:

     @component(...)
     class MyComponent {
       Watch watch;
       Scope scope;

       MyComponent(Dependency myDep, Scope scope) {
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

after:

     @component(...)
     class MyComponent implements ScopeAware {
       Watch watch;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope / RootScope argument to the
         // ctor and will result in a DI circular dependency error
		 // The scope is never accessible in the class constructor
       }

       void set scope(Scope scope) {
          // This setter gets called to initialize the scope
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

or

     @component(...)
     class MyComponent implements ScopeAware {
       Scope scope;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope / RootScope argument to the
         // ctor and will result in a DI circular dependency error
		 // The scope is never accessible in the class constructor
       }
     }
vicb added a commit to vicb/angular.dart that referenced this issue May 15, 2014
closes dart-archive#919
closes dart-archive#917

1) The @controller annotation is no more

It is possible to define the context of the root scope with:

    applicationFactory()
        ..rootContextType(RootContext)
        ..run();

The RootContext needs to be annotated with @Injectable():

    @Injectable()
    class RootContext {
      // ...
    }

2) You can not inject a scope in a component or in theroot context any
more

As the Scope context is set to the Component instance, the scope could
not be injected any more. Components should implements the "ScopeAware"
interface and declare a "scope" setter in order to get hold of the
scope.

before:

     @component(...)
     class MyComponent {
       Watch watch;
       Scope scope;

       MyComponent(Dependency myDep, Scope scope) {
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

after:

     @component(...)
     class MyComponent implements ScopeAware {
       Watch watch;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope / RootScope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }

       void set scope(Scope scope) {
          // This setter gets called to initialize the scope
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

or

     @component(...)
     class MyComponent implements ScopeAware {
       Scope scope;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope / RootScope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }
     }
vicb added a commit to vicb/angular.dart that referenced this issue May 16, 2014
closes dart-archive#919
closes dart-archive#917

1) The @controller annotation is no more

It is possible to define the context of the root scope with:

    applicationFactory()
        ..rootContextType(RootContext)
        ..run();

The RootContext needs to be annotated with @Injectable():

    @Injectable()
    class RootContext {
      // ...
    }

2) You can not inject a scope in a component or in theroot context any
more

As the Scope context is set to the Component instance, the scope could
not be injected any more. Components should implements the "ScopeAware"
interface and declare a "scope" setter in order to get hold of the
scope.

before:

     @component(...)
     class MyComponent {
       Watch watch;
       Scope scope;

       MyComponent(Dependency myDep, Scope scope) {
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

after:

     @component(...)
     class MyComponent implements ScopeAware {
       Watch watch;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope / RootScope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }

       void set scope(Scope scope) {
          // This setter gets called to initialize the scope
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

or

     @component(...)
     class MyComponent implements ScopeAware {
       Scope scope;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope / RootScope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }
     }
vicb added a commit to vicb/angular.dart that referenced this issue May 19, 2014
closes dart-archive#919
closes dart-archive#917

1) The @controller annotation is no more

It is possible to define the context of the root scope with:

    applicationFactory()
        ..rootContextType(RootContext)
        ..run();

The RootContext needs to be annotated with @Injectable():

    @Injectable()
    class RootContext {
      // ...
    }

2) You can not inject a scope in a component or in theroot context any
more

As the Scope context is set to the Component instance, the scope could
not be injected any more. Components should implements the "ScopeAware"
interface and declare a "scope" setter in order to get hold of the
scope.

before:

     @component(...)
     class MyComponent {
       Watch watch;
       Scope scope;

       MyComponent(Dependency myDep, Scope scope) {
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

after:

     @component(...)
     class MyComponent implements ScopeAware {
       Watch watch;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope / RootScope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }

       void set scope(Scope scope) {
          // This setter gets called to initialize the scope
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

or

     @component(...)
     class MyComponent implements ScopeAware {
       Scope scope;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope / RootScope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }
     }
vicb added a commit to vicb/angular.dart that referenced this issue May 20, 2014
closes dart-archive#919
closes dart-archive#917

1) The @controller annotation is no more

It is possible to define the context of the root scope with:

    applicationFactory()
        ..rootContextType(RootContext)
        ..run();

The RootContext needs to be annotated with @Injectable():

    @Injectable()
    class RootContext {
      // ...
    }

2) You can not inject a scope in a component or in theroot context any
more

As the Scope context is set to the Component instance, the scope could
not be injected any more. Components should implements the "ScopeAware"
interface and declare a "scope" setter in order to get hold of the
scope.

before:

     @component(...)
     class MyComponent {
       Watch watch;
       Scope scope;

       MyComponent(Dependency myDep, Scope scope) {
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

after:

     @component(...)
     class MyComponent implements ScopeAware {
       Watch watch;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope / RootScope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }

       void set scope(Scope scope) {
          // This setter gets called to initialize the scope
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

or

     @component(...)
     class MyComponent implements ScopeAware {
       Scope scope;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope / RootScope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }
     }
vicb added a commit to vicb/angular.dart that referenced this issue May 28, 2014
closes dart-archive#919
closes dart-archive#917

1) The @controller annotation is no more

It is possible to define the context of the root scope with:

    applicationFactory()
        ..rootContextType(RootContext)
        ..run();

The RootContext needs to be annotated with @Injectable():

    @Injectable()
    class RootContext {
      // ...
    }

2) You can not inject a scope in a component or in theroot context any
more

As the Scope context is set to the Component instance, the scope could
not be injected any more. Components should implements the "ScopeAware"
interface and declare a "scope" setter in order to get hold of the
scope.

before:

     @component(...)
     class MyComponent {
       Watch watch;
       Scope scope;

       MyComponent(Dependency myDep, Scope scope) {
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

after:

     @component(...)
     class MyComponent implements ScopeAware {
       Watch watch;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope / RootScope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }

       void set scope(Scope scope) {
          // This setter gets called to initialize the scope
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

or

     @component(...)
     class MyComponent implements ScopeAware {
       Scope scope;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope / RootScope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }
     }
vicb added a commit to vicb/angular.dart that referenced this issue May 28, 2014
closes dart-archive#919
closes dart-archive#917

1) The @controller annotation is no more

It is possible to define the context of the root scope with:

    applicationFactory()
        ..rootContextType(RootContext)
        ..run();

The RootContext needs to be annotated with @Injectable():

    @Injectable()
    class RootContext {
      // ...
    }

2) You can not inject a scope in a component or in theroot context any
more

As the Scope context is set to the Component instance, the scope could
not be injected any more. Components should implements the "ScopeAware"
interface and declare a "scope" setter in order to get hold of the
scope.

before:

     @component(...)
     class MyComponent {
       Watch watch;
       Scope scope;

       MyComponent(Dependency myDep, Scope scope) {
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

after:

     @component(...)
     class MyComponent implements ScopeAware {
       Watch watch;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope / RootScope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }

       void set scope(Scope scope) {
          // This setter gets called to initialize the scope
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

or

     @component(...)
     class MyComponent implements ScopeAware {
       Scope scope;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope / RootScope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }
     }
vicb added a commit to vicb/angular.dart that referenced this issue May 28, 2014
closes dart-archive#919
closes dart-archive#917

1) The @controller annotation is no more

It is possible to define the context of the root scope with:

    applicationFactory()
        ..rootContextType(RootContext)
        ..run();

The RootContext needs to be annotated with @Injectable():

    @Injectable()
    class RootContext {
      // ...
    }

2) You can not inject a scope in a component or in theroot context any
more

As the Scope context is set to the Component instance, the scope could
not be injected any more. Components should implements the "ScopeAware"
interface and declare a "scope" setter in order to get hold of the
scope.

before:

     @component(...)
     class MyComponent {
       Watch watch;
       Scope scope;

       MyComponent(Dependency myDep, Scope scope) {
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

after:

     @component(...)
     class MyComponent implements ScopeAware {
       Watch watch;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope / RootScope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }

       void set scope(Scope scope) {
          // This setter gets called to initialize the scope
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

or

     @component(...)
     class MyComponent implements ScopeAware {
       Scope scope;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope / RootScope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }
     }
@stiofand
Copy link

stiofand commented Jun 3, 2014

So whats the work around for @controller then, I cant see a clear explanation?

@vicb
Copy link
Contributor

vicb commented Jun 3, 2014

Do you have a specific question on what is unclear in the explanation above ?

@stiofand
Copy link

stiofand commented Jun 3, 2014

Since @controller is now depreciated, how do we construct and annotate our controllers? There is no guidance in the docs following the depreciation, there is no new implementation yet. A clear and plain example would be much appreciated (by many)

I also disagree, the example given above is not so clear at least not to me, particularly from a dev like me moving from AngularJS to Dart. Is the "Hello World Object a controller?" How do we reference it in scope, for example can we use an equivalent to publishAs:, especially if there are many controllers?

@vicb
Copy link
Contributor

vicb commented Jun 3, 2014

You are right: @Controller has been deprecated as an early warning but you should still use with all the official releases to date - the new way has not been published yet.

Once #1040 gets merged and released you won't be able to use @Controller any more, the commit comments have some details and we'll publish more.

@stiofand
Copy link

stiofand commented Jun 3, 2014

Aha, I see. My IDE (Web storm 8) throws a hissy fit, with it using 0.11.0, ill turn the warnings off, for now, if it still works then the issues is a red herring for now. Thanks for the help, ill keep an eye on the commits!

@antonmoiseev
Copy link

Unfortunately @Controller is already unusable in 0.11.0, if angular transformer is enabled in the pubspec.yaml. After transformation you get following error in the runtime: No getter for 'ctrl'.

@kinetifex
Copy link

I have replaced Controllers with Components.

To avoid having an extra view HTML file with a single element for my
component, in my routes I'm passing the element in the viewHtml to ngRoute,
i.e.:

'some_page': ngRoute(
path: '/some_page',
viewHtml: ''
)

For the angular team: Is this the intend flow moving forward?

Also, with Controllers, you could have different templates use a common
controller (useful for different displays of similar data). This isn't
possible with components since it's one template per component. Is the
solution here to annotate the same class as different Components with
different Templates?

On Wed, Jun 4, 2014 at 1:19 PM, Anton Moiseev [email protected]
wrote:

Unfortunately @controller is already unusable in 0.11.0, if angular
transformer is enabled in the pubspec.yaml. After transformation you get
following error in the runtime: No getter for 'ctrl'.


Reply to this email directly or view it on GitHub
#919 (comment)
.

@pcornelissen
Copy link

@antonmoiseev I am using multiple controllers in my 0.11 app. You just have to provide the html files to the transformer.
Have a look at https://github.com/orchit/angularDartBugShowcase

@antonmoiseev
Copy link

@pcornelissen thanks! Explicitly listing HTML files helped to workaround transformer's issue. However, packages/ format doesn't work for me, I use lib/.

@pcornelissen
Copy link

When you build the stuff on the console (that's at least what I do), then pub created all these links to the packages dir. If you're not on linux, this may be different.

vicb added a commit to vicb/angular.dart that referenced this issue Jul 16, 2014
closes dart-archive#919
closes dart-archive#917

1) The @controller has been removed

It is possible to define the context of the root scope with:

    applicationFactory()
        ..rootContextType(RootContext)
        ..run();

The root context type needs to be annotated with @Injectable():

    @Injectable()
    class RootContext {
      // ...
    }

2) You can not inject a scope in a component or in the root context any
more

As the Scope context is set to the Component instance, the scope could
not be injected any more. Components should implements the "ScopeAware"
interface and declare a "scope" setter in order to get a reference to
the scope.

before:

     @component(...)
     class MyComponent {
       Watch watch;
       Scope scope;

       MyComponent(Dependency myDep, Scope scope) {
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

after:

     @component(...)
     class MyComponent implements ScopeAware {
       Watch watch;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope / RootScope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }

       void set scope(Scope scope) {
          // This setter gets called to initialize the scope
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

or:

     @component(...)
     class MyComponent implements ScopeAware {
       Scope scope;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope / RootScope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }
     }
vicb added a commit to vicb/angular.dart that referenced this issue Jul 16, 2014
closes dart-archive#919
closes dart-archive#917

1) The @controller has been removed

It is possible to define the context of the root scope with:

    applicationFactory()
        ..rootContextType(RootContext)
        ..run();

The root context type needs to be annotated with @Injectable():

    @Injectable()
    class RootContext {
      // ...
    }

2) You can not inject a scope in a component or in the root context any
more

As the Scope context is set to the Component instance, the scope could
not be injected any more. Components should implements the "ScopeAware"
interface and declare a "scope" setter in order to get a reference to
the scope.

before:

     @component(...)
     class MyComponent {
       Watch watch;
       Scope scope;

       MyComponent(Dependency myDep, Scope scope) {
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

after:

     @component(...)
     class MyComponent implements ScopeAware {
       Watch watch;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope / RootScope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }

       void set scope(Scope scope) {
          // This setter gets called to initialize the scope
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

or:

     @component(...)
     class MyComponent implements ScopeAware {
       Scope scope;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope / RootScope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }
     }
vicb added a commit to vicb/angular.dart that referenced this issue Jul 17, 2014
closes dart-archive#919
closes dart-archive#917

1) The @controller has been removed

It is possible to define the context of the root scope with:

    applicationFactory()
        ..rootContextType(RootContext)
        ..run();

The root context type needs to be annotated with @Injectable():

    @Injectable()
    class RootContext {
      // ...
    }

2) You can not inject a scope in a component or in the root context any
more

As the Scope context is set to the Component instance, the scope could
not be injected any more. Components should implements the "ScopeAware"
interface and declare a "scope" setter in order to get a reference to
the scope.

before:

     @component(...)
     class MyComponent {
       Watch watch;
       Scope scope;

       MyComponent(Dependency myDep, Scope scope) {
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

after:

     @component(...)
     class MyComponent implements ScopeAware {
       Watch watch;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope / RootScope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }

       void set scope(Scope scope) {
          // This setter gets called to initialize the scope
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

or:

     @component(...)
     class MyComponent implements ScopeAware {
       Scope scope;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope / RootScope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }
     }
vicb added a commit to vicb/angular.dart that referenced this issue Jul 25, 2014
closes dart-archive#919
closes dart-archive#917

1) The @controller has been removed

It is possible to define the context of the root scope with:

    applicationFactory()
        ..rootContextType(RootContext)
        ..run();

The root context type needs to be annotated with @Injectable():

    @Injectable()
    class RootContext {
      // ...
    }

2) You can not inject a scope in a component or in the root context any
more

As the Scope context is set to the Component instance, the scope could
not be injected any more. Components should implements the "ScopeAware"
interface and declare a "scope" setter in order to get a reference to
the scope.

before:

     @component(...)
     class MyComponent {
       Watch watch;
       Scope scope;

       MyComponent(Dependency myDep, Scope scope) {
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

after:

     @component(...)
     class MyComponent implements ScopeAware {
       Watch watch;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope / RootScope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }

       void set scope(Scope scope) {
          // This setter gets called to initialize the scope
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

or:

     @component(...)
     class MyComponent implements ScopeAware {
       Scope scope;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope / RootScope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }
     }
vicb added a commit to vicb/angular.dart that referenced this issue Jul 28, 2014
closes dart-archive#919
closes dart-archive#917

1) The @controller has been removed

It is possible to define the context of the root scope with:

    applicationFactory()
        ..rootContextType(RootContext)
        ..run();

The root context type needs to be annotated with @Injectable():

    @Injectable()
    class RootContext {
      // ...
    }

2) You can not inject a scope in a component or in the root context any
more

As the Scope context is set to the Component instance, the scope could
not be injected any more. Components should implements the "ScopeAware"
interface and declare a "scope" setter in order to get a reference to
the scope.

before:

     @component(...)
     class MyComponent {
       Watch watch;
       Scope scope;

       MyComponent(Dependency myDep, Scope scope) {
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

after:

     @component(...)
     class MyComponent implements ScopeAware {
       Watch watch;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope / RootScope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }

       void set scope(Scope scope) {
          // This setter gets called to initialize the scope
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

or:

     @component(...)
     class MyComponent implements ScopeAware {
       Scope scope;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope / RootScope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }
     }
vicb added a commit to vicb/angular.dart that referenced this issue Jul 28, 2014
closes dart-archive#919
closes dart-archive#917

1) The @controller has been removed

It is possible to define the context of the root scope with:

    applicationFactory()
        ..rootContextType(RootContext)
        ..run();

The root context type needs to be annotated with @Injectable():

    @Injectable()
    class RootContext {
      // ...
    }

2) You can not inject a scope in a component or in the root context any
more

As the Scope context is set to the Component instance, the scope could
not be injected any more. Components should implements the "ScopeAware"
interface and declare a "scope" setter in order to get a reference to
the scope.

before:

     @component(...)
     class MyComponent {
       Watch watch;
       Scope scope;

       MyComponent(Dependency myDep, Scope scope) {
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

after:

     @component(...)
     class MyComponent implements ScopeAware {
       Watch watch;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope / RootScope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }

       void set scope(Scope scope) {
          // This setter gets called to initialize the scope
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

or:

     @component(...)
     class MyComponent implements ScopeAware {
       Scope scope;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope / RootScope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }
     }
vicb added a commit to vicb/angular.dart that referenced this issue Jul 30, 2014
closes dart-archive#919
closes dart-archive#917

1) The @controller has been removed

It is possible to define the context of the root scope with:

    applicationFactory()
        ..rootContextType(RootContext)
        ..run();

The root context type needs to be annotated with @Injectable():

    @Injectable()
    class RootContext {
      // ...
    }

2) You can not inject a scope in a component or in the root context any
more

As the Scope context is set to the Component instance, the scope could
not be injected any more. Components should implements the "ScopeAware"
interface and declare a "scope" setter in order to get a reference to
the scope.

before:

     @component(...)
     class MyComponent {
       Watch watch;
       Scope scope;

       MyComponent(Dependency myDep, Scope scope) {
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

after:

     @component(...)
     class MyComponent implements ScopeAware {
       Watch watch;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope / RootScope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }

       void set scope(Scope scope) {
          // This setter gets called to initialize the scope
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

or:

     @component(...)
     class MyComponent implements ScopeAware {
       Scope scope;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope / RootScope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }
     }
vicb added a commit to vicb/angular.dart that referenced this issue Jul 31, 2014
closes dart-archive#919
closes dart-archive#917

1) The @controller has been removed

It is possible to define the context of the root scope with:

    applicationFactory()
        ..rootContextType(RootContext)
        ..run();

The root context type needs to be annotated with @Injectable():

    @Injectable()
    class RootContext {
      // ...
    }

2) You can not inject a scope in a component or in the root context any
more

As the Scope context is set to the Component instance, the scope could
not be injected any more. Components should implements the "ScopeAware"
interface and declare a "scope" setter in order to get a reference to
the scope.

before:

     @component(...)
     class MyComponent {
       Watch watch;
       Scope scope;

       MyComponent(Dependency myDep, Scope scope) {
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

after:

     @component(...)
     class MyComponent implements ScopeAware {
       Watch watch;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope / RootScope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }

       void set scope(Scope scope) {
          // This setter gets called to initialize the scope
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

or:

     @component(...)
     class MyComponent implements ScopeAware {
       Scope scope;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope / RootScope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }
     }
rkirov pushed a commit to rkirov/angular.dart that referenced this issue Jul 31, 2014
closes dart-archive#919
closes dart-archive#917

1) The @controller has been removed

It is possible to define the context of the root scope with:

    applicationFactory()
        ..rootContextType(RootContext)
        ..run();

The root context type needs to be annotated with @Injectable():

    @Injectable()
    class RootContext {
      // ...
    }

2) You can not inject a scope in a component or in the root context any
more

As the Scope context is set to the Component instance, the scope could
not be injected any more. Components should implements the "ScopeAware"
interface and declare a "scope" setter in order to get a reference to
the scope.

before:

     @component(...)
     class MyComponent {
       Watch watch;
       Scope scope;

       MyComponent(Dependency myDep, Scope scope) {
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

after:

     @component(...)
     class MyComponent implements ScopeAware {
       Watch watch;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope / RootScope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }

       void set scope(Scope scope) {
          // This setter gets called to initialize the scope
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

or:

     @component(...)
     class MyComponent implements ScopeAware {
       Scope scope;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope / RootScope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }
     }
vicb added a commit to vicb/angular.dart that referenced this issue Aug 1, 2014
closes dart-archive#919
closes dart-archive#917

Backard Compatibility breaks:

1) The @controller has been removed

It is possible to define the context of the root scope with:

    applicationFactory()
        ..rootContextType(RootContext)
        ..run();

The root context type needs to be annotated with @Injectable():

    @Injectable()
    class RootContext {
      // ...
    }

2) You can not inject a scope in a component or in the root context any
more

As the Scope context is set to the Component instance, the scope could
not be injected any more. Components should implements the "ScopeAware"
interface and declare a "scope" setter in order to get a reference to
the scope.

before:

     @component(...)
     class MyComponent {
       Watch watch;
       Scope scope;

       MyComponent(Dependency myDep, Scope scope) {
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

after:

     @component(...)
     class MyComponent implements ScopeAware {
       Watch watch;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope / RootScope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }

       void set scope(Scope scope) {
          // This setter gets called to initialize the scope
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

or:

     @component(...)
     class MyComponent implements ScopeAware {
       Scope scope;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope / RootScope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }
     }
@youssefgh
Copy link

@kinetifex i found your question very important, because it reflect what am searching for too.
I found that we can use rootContextType instead of Controller (in your case) in the current version as described in the first comment.
You also can refer to this PR for examples https://github.com/angular/angular.dart/pull/1401/files.
I still cant find how to properly move from Controller's to rootContextType when we are dealing with too much code inside Controller's, because -obviously- it would make our class bigger and harder to maintain.

rkirov pushed a commit to rkirov/angular.dart that referenced this issue Sep 4, 2014
BREAKING CHANGE:

Scope context is set to the component instance that trigged the creation
of the scope (previously it was of a PrototypeMap.)

Repercussions:
1) You can not inject a scope in a component or in the root context any
more.

As the Scope context is set to the Component instance, the scope could
not be injected any more. Components should implements the "ScopeAware"
interface and declare a "scope" setter in order to get a reference to
the scope.

before:

     @component(...)
     class MyComponent {
       Watch watch;
       Scope scope;

       MyComponent(Dependency myDep, Scope scope) {
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

after:

     @component(...)
     class MyComponent implements ScopeAware {
       Watch watch;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }

       void set scope(Scope scope) {
          // This setter gets called to initialize the scope
          watch = scope.watch("expression", (v, p) => ...);
       }
     }

or:

     @component(...)
     class MyComponent implements ScopeAware {
       Scope scope;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }
     }

2) The parent component to an NgForm must have a "$name" field to store
   the form instance.

closes dart-archive#919
closes dart-archive#917
rkirov pushed a commit to rkirov/angular.dart that referenced this issue Sep 5, 2014
BREAKING CHANGE:

Scope context is set to the component instance that trigged the creation
of the scope (previously it was of a PrototypeMap.)

Repercussions:
1) You can not inject a scope in a component or in the root context any
more.

As the Scope context is set to the Component instance, the scope could
not be injected any more. Components should implements the "ScopeAware"
interface and declare a "scope" setter in order to get a reference to
the scope.

before:

     @component(...)
     class MyComponent {
       Watch watch;
       Scope scope;

       MyComponent(Dependency myDep, Scope scope) {
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

after:

     @component(...)
     class MyComponent implements ScopeAware {
       Watch watch;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }

       void set scope(Scope scope) {
          // This setter gets called to initialize the scope
          watch = scope.watch("expression", (v, p) => ...);
       }
     }

or:

     @component(...)
     class MyComponent implements ScopeAware {
       Scope scope;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }
     }

2) The parent component to an NgForm must have a "$name" field to store
   the form instance.

closes dart-archive#919
closes dart-archive#917
rkirov pushed a commit to rkirov/angular.dart that referenced this issue Sep 5, 2014
BREAKING CHANGE:

Scope context is set to the component instance that trigged the creation
of the scope (previously it was of a PrototypeMap.)

Repercussions:
1) You can not inject a scope in a component or in the root context any
more.

As the Scope context is set to the Component instance, the scope could
not be injected any more. Components should implements the "ScopeAware"
interface and declare a "scope" setter in order to get a reference to
the scope.

before:

     @component(...)
     class MyComponent {
       Watch watch;
       Scope scope;

       MyComponent(Dependency myDep, Scope scope) {
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

after:

     @component(...)
     class MyComponent implements ScopeAware {
       Watch watch;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }

       void set scope(Scope scope) {
          // This setter gets called to initialize the scope
          watch = scope.watch("expression", (v, p) => ...);
       }
     }

or:

     @component(...)
     class MyComponent implements ScopeAware {
       Scope scope;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }
     }

2) The parent component to an NgForm must have a "$name" field to store
   the form instance.

closes dart-archive#919
closes dart-archive#917
rkirov pushed a commit to rkirov/angular.dart that referenced this issue Sep 8, 2014
BREAKING CHANGE:

Scope context is set to the component instance that trigged the creation
of the scope (previously it was of a PrototypeMap.)

Repercussions:
1) You can not inject a scope in a component or in the root context any
more.

As the Scope context is set to the Component instance, the scope could
not be injected any more. Components should implements the "ScopeAware"
interface and declare a "scope" setter in order to get a reference to
the scope.

before:

     @component(...)
     class MyComponent {
       Watch watch;
       Scope scope;

       MyComponent(Dependency myDep, Scope scope) {
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

after:

     @component(...)
     class MyComponent implements ScopeAware {
       Watch watch;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }

       void set scope(Scope scope) {
          // This setter gets called to initialize the scope
          watch = scope.watch("expression", (v, p) => ...);
       }
     }

or:

     @component(...)
     class MyComponent implements ScopeAware {
       Scope scope;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }
     }

2) The parent component to an NgForm must have a "$name" field to store
   the form instance.

closes dart-archive#919
closes dart-archive#917
rkirov pushed a commit to rkirov/angular.dart that referenced this issue Sep 8, 2014
BREAKING CHANGE:

Scope context is set to the component instance that trigged the creation
of the scope (previously it was of a PrototypeMap.)

Repercussions:
1) You can not inject a scope in a component or in the root context any
more.

As the Scope context is set to the Component instance, the scope could
not be injected any more. Components should implements the "ScopeAware"
interface and declare a "scope" setter in order to get a reference to
the scope.

before:

     @component(...)
     class MyComponent {
       Watch watch;
       Scope scope;

       MyComponent(Dependency myDep, Scope scope) {
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

after:

     @component(...)
     class MyComponent implements ScopeAware {
       Watch watch;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }

       void set scope(Scope scope) {
          // This setter gets called to initialize the scope
          watch = scope.watch("expression", (v, p) => ...);
       }
     }

or:

     @component(...)
     class MyComponent implements ScopeAware {
       Scope scope;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }
     }

2) The parent component to an NgForm must have a "$name" field to store
   the form instance.

closes dart-archive#919
closes dart-archive#917
rkirov pushed a commit to rkirov/angular.dart that referenced this issue Sep 11, 2014
BREAKING CHANGE:

Scope context is set to the component instance that trigged the creation
of the scope (previously it was of a PrototypeMap.)

Repercussions:
1) You can not inject a scope in a component or in the root context any
more.

As the Scope context is set to the Component instance, the scope could
not be injected any more. Components should implements the "ScopeAware"
interface and declare a "scope" setter in order to get a reference to
the scope.

before:

     @component(...)
     class MyComponent {
       Watch watch;
       Scope scope;

       MyComponent(Dependency myDep, Scope scope) {
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

after:

     @component(...)
     class MyComponent implements ScopeAware {
       Watch watch;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }

       void set scope(Scope scope) {
          // This setter gets called to initialize the scope
          watch = scope.watch("expression", (v, p) => ...);
       }
     }

or:

     @component(...)
     class MyComponent implements ScopeAware {
       Scope scope;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }
     }

2) The parent component to an NgForm must have a "$name" field to store
   the form instance.

closes dart-archive#919
closes dart-archive#917
rkirov pushed a commit to rkirov/angular.dart that referenced this issue Sep 12, 2014
BREAKING CHANGE:

Scope context is set to the component instance that trigged the creation
of the scope (previously it was of a PrototypeMap.)

Repercussions:
1) You can not inject a scope in a component or in the root context any
more.

As the Scope context is set to the Component instance, the scope could
not be injected any more. Components should implements the "ScopeAware"
interface and declare a "scope" setter in order to get a reference to
the scope.

before:

     @component(...)
     class MyComponent {
       Watch watch;
       Scope scope;

       MyComponent(Dependency myDep, Scope scope) {
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

after:

     @component(...)
     class MyComponent implements ScopeAware {
       Watch watch;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }

       void set scope(Scope scope) {
          // This setter gets called to initialize the scope
          watch = scope.watch("expression", (v, p) => ...);
       }
     }

or:

     @component(...)
     class MyComponent implements ScopeAware {
       Scope scope;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }
     }

2) The parent component to an NgForm must have a "$name" field to store
   the form instance.

closes dart-archive#919
closes dart-archive#917
rkirov pushed a commit to rkirov/angular.dart that referenced this issue Sep 12, 2014
BREAKING CHANGE:

Scope context is set to the component instance that trigged the creation
of the scope (previously it was of a PrototypeMap.)

Repercussions:
1) You can not inject a scope in a component or in the root context any
more.

As the Scope context is set to the Component instance, the scope could
not be injected any more. Components should implements the "ScopeAware"
interface and declare a "scope" setter in order to get a reference to
the scope.

before:

     @component(...)
     class MyComponent {
       Watch watch;
       Scope scope;

       MyComponent(Dependency myDep, Scope scope) {
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

after:

     @component(...)
     class MyComponent implements ScopeAware {
       Watch watch;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }

       void set scope(Scope scope) {
          // This setter gets called to initialize the scope
          watch = scope.watch("expression", (v, p) => ...);
       }
     }

or:

     @component(...)
     class MyComponent implements ScopeAware {
       Scope scope;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }
     }

2) The parent component to an NgForm must have a "$name" field to store
   the form instance.

closes dart-archive#919
closes dart-archive#917
rkirov pushed a commit to rkirov/angular.dart that referenced this issue Sep 15, 2014
BREAKING CHANGE:

Scope context is set to the component instance that trigged the creation
of the scope (previously it was of a PrototypeMap.)

Repercussions:
1) You can not inject a scope in a component or in the root context any
more.

As the Scope context is set to the Component instance, the scope could
not be injected any more. Components should implements the "ScopeAware"
interface and declare a "scope" setter in order to get a reference to
the scope.

before:

     @component(...)
     class MyComponent {
       Watch watch;
       Scope scope;

       MyComponent(Dependency myDep, Scope scope) {
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

after:

     @component(...)
     class MyComponent implements ScopeAware {
       Watch watch;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }

       void set scope(Scope scope) {
          // This setter gets called to initialize the scope
          watch = scope.watch("expression", (v, p) => ...);
       }
     }

or:

     @component(...)
     class MyComponent implements ScopeAware {
       Scope scope;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }
     }

2) The parent component to an NgForm must have a "$name" field to store
   the form instance.

closes dart-archive#919
closes dart-archive#917
rkirov pushed a commit to rkirov/angular.dart that referenced this issue Sep 15, 2014
BREAKING CHANGE:

Scope context is set to the component instance that trigged the creation
of the scope (previously it was of a PrototypeMap.)

Repercussions:
1) You can not inject a scope in a component or in the root context any
more.

As the Scope context is set to the Component instance, the scope could
not be injected any more. Components should implements the "ScopeAware"
interface and declare a "scope" setter in order to get a reference to
the scope.

before:

     @component(...)
     class MyComponent {
       Watch watch;
       Scope scope;

       MyComponent(Dependency myDep, Scope scope) {
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

after:

     @component(...)
     class MyComponent implements ScopeAware {
       Watch watch;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }

       void set scope(Scope scope) {
          // This setter gets called to initialize the scope
          watch = scope.watch("expression", (v, p) => ...);
       }
     }

or:

     @component(...)
     class MyComponent implements ScopeAware {
       Scope scope;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }
     }

2) The parent component to an NgForm must have a "$name" field to store
   the form instance.

closes dart-archive#919
closes dart-archive#917
rkirov pushed a commit to rkirov/angular.dart that referenced this issue Sep 24, 2014
BREAKING CHANGE:

Scope context is set to the component instance that trigged the creation
of the scope (previously it was of a PrototypeMap.)

Repercussions:
1) You can not inject a scope in a component or in the root context any
more.

As the Scope context is set to the Component instance, the scope could
not be injected any more. Components should implements the "ScopeAware"
interface and declare a "scope" setter in order to get a reference to
the scope.

before:

     @component(...)
     class MyComponent {
       Watch watch;
       Scope scope;

       MyComponent(Dependency myDep, Scope scope) {
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

after:

     @component(...)
     class MyComponent implements ScopeAware {
       Watch watch;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }

       void set scope(Scope scope) {
          // This setter gets called to initialize the scope
          watch = scope.watch("expression", (v, p) => ...);
       }
     }

or:

     @component(...)
     class MyComponent implements ScopeAware {
       Scope scope;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }
     }

2) The parent component to an NgForm must have a "$name" field to store
   the form instance.

closes dart-archive#919
closes dart-archive#917
rkirov pushed a commit to rkirov/angular.dart that referenced this issue Sep 29, 2014
BREAKING CHANGE:

Scope context is set to the component instance that trigged the creation
of the scope (previously it was of a PrototypeMap.)

Repercussions:
1) You can not inject a scope in a component or in the root context any
more.

As the Scope context is set to the Component instance, the scope could
not be injected any more. Components should implements the "ScopeAware"
interface and declare a "scope" setter in order to get a reference to
the scope.

before:

     @component(...)
     class MyComponent {
       Watch watch;
       Scope scope;

       MyComponent(Dependency myDep, Scope scope) {
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

after:

     @component(...)
     class MyComponent implements ScopeAware {
       Watch watch;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }

       void set scope(Scope scope) {
          // This setter gets called to initialize the scope
          watch = scope.watch("expression", (v, p) => ...);
       }
     }

or:

     @component(...)
     class MyComponent implements ScopeAware {
       Scope scope;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }
     }

2) The parent component to an NgForm must have a "$name" field to store
   the form instance.

closes dart-archive#919
closes dart-archive#917
rkirov pushed a commit to rkirov/angular.dart that referenced this issue Sep 29, 2014
BREAKING CHANGE:

Scope context is set to the component instance that trigged the creation
of the scope (previously it was of a PrototypeMap.)

Repercussions:
1) You can not inject a scope in a component or in the root context any
more.

As the Scope context is set to the Component instance, the scope could
not be injected any more. Components should implements the "ScopeAware"
interface and declare a "scope" setter in order to get a reference to
the scope.

before:

     @component(...)
     class MyComponent {
       Watch watch;
       Scope scope;

       MyComponent(Dependency myDep, Scope scope) {
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

after:

     @component(...)
     class MyComponent implements ScopeAware {
       Watch watch;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }

       void set scope(Scope scope) {
          // This setter gets called to initialize the scope
          watch = scope.watch("expression", (v, p) => ...);
       }
     }

or:

     @component(...)
     class MyComponent implements ScopeAware {
       Scope scope;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }
     }

2) The parent component to an NgForm must have a "$name" field to store
   the form instance.

closes dart-archive#919
closes dart-archive#917
rkirov pushed a commit to rkirov/angular.dart that referenced this issue Sep 30, 2014
BREAKING CHANGE:

Scope context is set to the component instance that trigged the creation
of the scope (previously it was of a PrototypeMap.)

Repercussions:
1) You can not inject a scope in a component or in the root context any
more.

As the Scope context is set to the Component instance, the scope could
not be injected any more. Components should implements the "ScopeAware"
interface and declare a "scope" setter in order to get a reference to
the scope.

before:

     @component(...)
     class MyComponent {
       Watch watch;
       Scope scope;

       MyComponent(Dependency myDep, Scope scope) {
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

after:

     @component(...)
     class MyComponent implements ScopeAware {
       Watch watch;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }

       void set scope(Scope scope) {
          // This setter gets called to initialize the scope
          watch = scope.watch("expression", (v, p) => ...);
       }
     }

or:

     @component(...)
     class MyComponent implements ScopeAware {
       Scope scope;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }
     }

2) The parent component to an NgForm must have a "$name" field to store
   the form instance.

closes dart-archive#919
closes dart-archive#917
rkirov pushed a commit to rkirov/angular.dart that referenced this issue Oct 1, 2014
BREAKING CHANGE:

Scope context is set to the component instance that trigged the creation
of the scope (previously it was of a PrototypeMap.)

Repercussions:
1) You can not inject a scope in a component or in the root context any
more.

As the Scope context is set to the Component instance, the scope could
not be injected any more. Components should implements the "ScopeAware"
interface and declare a "scope" setter in order to get a reference to
the scope.

before:

     @component(...)
     class MyComponent {
       Watch watch;
       Scope scope;

       MyComponent(Dependency myDep, Scope scope) {
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

after:

     @component(...)
     class MyComponent implements ScopeAware {
       Watch watch;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }

       void set scope(Scope scope) {
          // This setter gets called to initialize the scope
          watch = scope.watch("expression", (v, p) => ...);
       }
     }

or:

     @component(...)
     class MyComponent implements ScopeAware {
       Scope scope;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }
     }

2) The parent component to an NgForm must have a "$name" field to store
   the form instance.

closes dart-archive#919
closes dart-archive#917
rkirov pushed a commit to rkirov/angular.dart that referenced this issue Oct 2, 2014
BREAKING CHANGE:

Scope context is set to the component instance that trigged the creation
of the scope (previously it was of a PrototypeMap.)

Repercussions:
1) You can not inject a scope in a component or in the root context any
more.

As the Scope context is set to the Component instance, the scope could
not be injected any more. Components should implements the "ScopeAware"
interface and declare a "scope" setter in order to get a reference to
the scope.

before:

     @component(...)
     class MyComponent {
       Watch watch;
       Scope scope;

       MyComponent(Dependency myDep, Scope scope) {
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

after:

     @component(...)
     class MyComponent implements ScopeAware {
       Watch watch;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }

       void set scope(Scope scope) {
          // This setter gets called to initialize the scope
          watch = scope.watch("expression", (v, p) => ...);
       }
     }

or:

     @component(...)
     class MyComponent implements ScopeAware {
       Scope scope;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }
     }

2) The parent component to an NgForm must have a "$name" field to store
   the form instance.

closes dart-archive#919
closes dart-archive#917
vicb added a commit that referenced this issue Oct 2, 2014
BREAKING CHANGE:

Scope context is set to the component instance that trigged the creation
of the scope (previously it was of a PrototypeMap.)

Repercussions:
1) You can not inject a scope in a component or in the root context any
more.

As the Scope context is set to the Component instance, the scope could
not be injected any more. Components should implements the "ScopeAware"
interface and declare a "scope" setter in order to get a reference to
the scope.

before:

     @component(...)
     class MyComponent {
       Watch watch;
       Scope scope;

       MyComponent(Dependency myDep, Scope scope) {
          watch = scope.rootScope.watch("expression", (v, p) => ...);
       }
     }

after:

     @component(...)
     class MyComponent implements ScopeAware {
       Watch watch;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }

       void set scope(Scope scope) {
          // This setter gets called to initialize the scope
          watch = scope.watch("expression", (v, p) => ...);
       }
     }

or:

     @component(...)
     class MyComponent implements ScopeAware {
       Scope scope;

       MyComponent(Dependency myDep) {
         // It is an error to add a Scope argument to the
         // ctor and will result in a DI circular dependency error
         // The scope is never accessible in the class constructor
       }
     }

2) The parent component to an NgForm must have a "$name" field to store
   the form instance.

closes #919
closes #917
@vicb vicb closed this as completed in a4f08a7 Oct 2, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging a pull request may close this issue.

10 participants