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

di: Provider with useValue doesn't accept const complex data type instances #10

@frankpepermans

Description

@frankpepermans

In beta 18, declaring a Provider with useValue currently fails in the angular transfomer if you use an instance of a complex data type.

For example, use the following setup to define a component:

class Bar {
   const Bar();
}

@Component(
    selector: 'foo',
    template: '<div></div>',
    providers: const [const Provider(DisplayOptions, useValue: const Bar())]
)
class Foo {
}

This throws Invalid argument(s): Incorrect identifier "const Bar()"

And the stack trace is:

package:angular2/src/transform/common/type_metadata_reader.dart 1357:7   _readIdentifier
package:angular2/src/transform/common/type_metadata_reader.dart 1375:12  _readValue
package:angular2/src/transform/common/type_metadata_reader.dart 1166:20  _readProvider.<fn>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions