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

After Upgrade: EXCEPTION: No provider found for dynamic: MyFormService -> dynamic #1851

Open
sgon00 opened this issue Aug 10, 2019 · 1 comment

Comments

@sgon00
Copy link

sgon00 commented Aug 10, 2019

Hi, the angular app has no problem at all before the upgrade.

After upgrade to:

Dart: 2.2.1-dev.3.0

and From

  angular: ^5.2.0
  angular_forms: ^2.1.1
  build_runner: ^1.0.0
  build_web_compilers: ^1.0.0

To

  angular: ^5.3.1
  angular_forms: ^2.1.2

  build_runner: ^1.2.8
  build_web_compilers: ^1.2.2

I am getting this error message from chrome console:

dart_sdk.js:100492 EXCEPTION: No provider found for dynamic: MyFormService -> dynamic.
**NOTE**: This path is not exhaustive, and nodes may be missing in between the "->" delimiters. There is ongoing work to improve this error message and include all the nodes where possible. 

Btw, there is no problem and error msg from pub get and webdev serve.

I have no idea what the problem is.

Some of the code from app_component.dart:

import 'package:angular/angular.dart';
import 'package:angular_forms/angular_forms.dart';
import 'package:mypackage/src/service/my_form_service.dart';

@Component(
  selector: 'my-app',
  templateUrl: 'app_component.html',
  styleUrls: ['app_component.css'],
  directives: [coreDirectives, formDirectives],
  providers: [ClassProvider(MyFormService)],
)
class AppComponent implements OnInit {

Can anyone please help?
Thank you very much.

@sgon00
Copy link
Author

sgon00 commented Aug 10, 2019

After reading #1847, I changed import 'dart:html' in my_form_service.dart to import 'dart:html' as html;, then it works.

The workaround import 'dart:html' hide Location; does NOT work.

This is just the most crazy bug I ever saw. It just doesn't make sense from error message in the chrome console.

No error message from webdev serve and my VSCode editor.

#1847 should never be closed. This wasted me a day to figure out.

I think this issue should not be closed until import 'dart:html' works.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant