Skip to content
This repository has been archived by the owner on Sep 16, 2022. It is now read-only.

5.0.0-alpha+11

Compare
Choose a tag to compare
@matanlurey matanlurey released this 23 Apr 22:15
· 1733 commits to master since this release

angular

5.0.0-alpha+11

Breaking changes

  • Removed ApplicationRef.injector from the public API. This was a sparingly
    used API, and it was usually incorrect to specifically use this injector
    over the current injector in the component context or the root component's
    Injector.

  • Removed the experimental parent argument to ApplicationRef.bootstrap.
    It is no longer needed since all applications use the same bootstrap code
    branch (either runApp, or code that eventually runs through runApp).

  • Removed the rarely used template attribute syntax. Uses can be replaced
    with either the * micro-syntax, or a <template> element.

    Before

      <div template="ngFor let item of items; trackBy: trackById; let i=index">
        {{i}}: {{item}}
      </div>

    After

    <!-- * micro-syntax -->
    <div *ngFor="let item of items; trackBy: trackById; let i=index">
      {{i}}: {{item}}
    </div>
    
    <!-- <template> element -->
    <template
        ngFor
        let-item
        [ngForOf]="items"
        [ngForTrackBy]="trackById"
        let-i="index">
      <div>
        {{i}}: {{item}}
      </div>
    </template>

New features

  • The new Module syntax for dependency injection is shipped! This is an
    optional feature instead of using nested const lists to represent sets
    of shared providers. For example, instead of the following:

    const httpModule = const [ /* Other providers and/or modules. */ ];
    
    const commonModule = const [
      httpModule,
      const ClassProvider(AuthService, useClass: OAuthService),
      const FactoryProvider.forToken(xsrfToken, useFactory: readXsrfToken),
    ];

    ... you can represent this with the new typed Module syntax:

    const httpModule = const Module( /* ... Configuration ... */);
    
    const commonModule = const Module(
      include: const [httpModule],
      provide: const [
        const ClassProvider(AuthService, useClass: OAuthService),
        const FactoryProvider.forToken(xsrfToken, useFactory: readXsrfToken),
      ],
    );

    The advantages here are numerous:

    • Less ambiguity around ordering of providers. Engineers would tend to try
      and sort providers alphabetically, would of course, would lead to
      problems. Module specifically outlines that order is significant, and
      that include is processed before provide.

    • Module rejects using a Type implicitly as a ClassProvider. This
      removes additional ambiguity around supporting List<dynamic>, and while
      more verbose, should lead to more correct use.

    • Module tends to be more understandable by users of other dependency
      injection systems such as Guice or Dagger, and reads better than a const
      List (which is a very Dart-only idiom).

    We're not yet updating the [style guide]
    (https://github.com/dart-lang/angular/blob/master/doc/effective/di.md) in
    this release, but we are looking for users to help validate that this is
    the way to go for the future.

    NOTE: It is also possible to use Module in @GenerateInjector:

    @GenerateInjector.fromModules(const [
      const Module(
        include: const [
          const Module(
            provide: const [
              const ValueProvider(ExampleService, const ExampleService()),
            ],
          ),
        ],
        provide: const [
          const ValueProvider(ExampleService2, const ExampleService2()),
          const ExistingProvider(ExampleService, ExampleService2),
        ],
      ),
    ])
    final InjectorFactory exampleFromModule = ng.exampleFromModule$Injector;

    NOTE: It is also possible to use Module in ReflectiveInjector:

    // Using ReflectiveInjector is strongly not recommended for new code
    // due to adverse effects on code-size and runtime performance.
    final injector = ReflectiveInjector.resolveAndCreate([
      const Module(
        include: const [
          const Module(
            provide: const [
              const ValueProvider(ExampleService, const ExampleService()),
            ],
          ),
        ],
        provide: const [
          const ValueProvider(ExampleService2, const ExampleService2()),
          const ExistingProvider(ExampleService, ExampleService2),
        ],
      ),
    ]);
  • @HostListener() can now automatically infer the const ['$event']
    parameter when it is omitted but the bound method has a single argument:

    class Comp {
      @HostListener('click')
      void onClick(MouseEvent e) {}
    }

Bug fixes

  • The * micro-syntax now supports newlines after an identifier.

  • The compiler is now reporting errors again for invalid property bindings on
    <template> elements.

angular_ast

0.5.2

  • The * micro-syntax now supports newlines after an identifier.

angular_compiler

0.4.0-alpha+11

  • Added ModuleReader.extractProviderObjects to use in the view compiler.
  • Added logFine as a new top-level API.

angular_forms

2.0.0-alpha+3

New Features

  • Add ngDisabled input to all Control directives.

Breaking Changes

  • NgControlGroup can no longer be injected directly. It can still be
    injected as a ControlContainer.

  • NgControlName and NgFormControl can no longer be injected directly. They
    can still be injected as a NgControl.

  • CheckboxControlValueAccessor, DefaultValueAccessor,
    NumberValueAccessor, RadioControlValueAccessor, and NgSelectOption can
    no longer be injected directly.

angular_router

2.0.0-alpha+11

New features

  • Added the method navigateByUrl to Router.

angular_test

2.0.0-alpha+9

  • pub run angular_test was entirely removed. This hasn't worked since
    2.0.0-alpha+3, but instead threw an error message reminding users it was
    no longer supported.