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

Created on 10 Aug 2019  路  1Comment  路  Source: angulardart/angular

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.

Most helpful comment

After reading https://github.com/dart-lang/angular/issues/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.

https://github.com/dart-lang/angular/issues/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.

>All comments

After reading https://github.com/dart-lang/angular/issues/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.

https://github.com/dart-lang/angular/issues/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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

matanlurey picture matanlurey  路  3Comments

Tomucha picture Tomucha  路  5Comments

ranquild picture ranquild  路  6Comments

matanlurey picture matanlurey  路  4Comments

supermuka picture supermuka  路  5Comments