Skip to content
This repository has been archived by the owner on Jan 29, 2024. It is now read-only.

Provider issue in windows chrome #1746

Open
HarryF514 opened this issue Jun 8, 2017 · 4 comments
Open

Provider issue in windows chrome #1746

HarryF514 opened this issue Jun 8, 2017 · 4 comments

Comments

@HarryF514
Copy link

HarryF514 commented Jun 8, 2017

Subject of the issue

angular.js:66 Uncaught Error: [$injector:unpr] Unknown provider: $translateStaticFilesLoaderProvider <- $translateStaticFilesLoader <- $translate

Your environment

  • angular-translate version : 2.15.1
  • version of angular: 1.6.4
  • chrome in windows, chrome version : 58.0.3029.110 (64-bit)

Steps to reproduce

Tell us how to reproduce this issue. Please provide a working demo, you can use this template as a base.

`

            $translateProvider.useStaticFilesLoader({
		            prefix: 'l10n/',
		            suffix: '.json'
	});

	$translateProvider.preferredLanguage(window.navigator.language);
	$translateProvider.fallbackLanguage('zh-CN');

`

Expected behaviour

open console in chrome, see the error message:
Uncaught Error: [$injector:unpr] Unknown provider: $translateStaticFilesLoaderProvider <- $translateStaticFilesLoader <- $translate

Actual behaviour

should have no error

@HarryF514
Copy link
Author

a, find solution for myself, I need to do:

bower install angular-translate-loader-static-files

confuse sometime that I can see theuseStaticFilesLoader function without loading the angular-translate-loader-static-files.min.js script

@knalli
Copy link
Member

knalli commented Jun 22, 2017

Well, indeed: The helper useStaticFilesLoader() is available without the actual implementation.
Maybe we could improve the error message with a proper hint (if not exist raise custom error).

Maybe you give a PR a try? :)

@HarryF514
Copy link
Author

Sure.

@knalli
Copy link
Member

knalli commented Jun 22, 2017

Great! I guess this could be realized with the $injector just like in cookies https://github.com/angular-translate/angular-translate/blob/2.15.1/src/service/storage-cookie.js#L15-L41 ..

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

No branches or pull requests

2 participants