Skip to content
This repository was archived by the owner on Feb 2, 2025. It is now read-only.
This repository was archived by the owner on Feb 2, 2025. It is now read-only.

withLanguageSource broken with angular 1.6.x #971

@bolemeus

Description

@bolemeus

What versions you are using?

  • angular version: 1.6.2
  • jquery version: 3.1.1
  • datatables version: 1.10.13
  • angular-datatables version: 0.6.0
  • angular-MM version:

What's the problem?

I'm migrating from angular 1.4.9 to 1.6.2 and angular-datatables from 0.5.5 to 0.6.0.
I've noticed that the localization no longer works.
The language options are now returned in the data property when doing an $http call (see angular docs)

I've narrowed it down to line 98 of angular-datatables.
I've changed

if (options.language && options.language.url) {
	var languageDefer = $q.defer();
	var languageUrl = options.language.url;
	$http.get(options.language.url).then(function(language) {
		languageDefer.resolve(language);
	}, function() {
		$log.error('Could not fetch the content of the language from ' + languageUrl);
	});
	options.language = languageDefer.promise;
}

to

if (options.language && options.language.url) {
	var languageDefer = $q.defer();
	var languageUrl = options.language.url;
	$http.get(options.language.url).then(function(language) {
		languageDefer.resolve(language.data);    // This line
	}, function() {
		$log.error('Could not fetch the content of the language from ' + languageUrl);
	});
	options.language = languageDefer.promise;
}

and its working again.

Thesame would be true for line 645, but that line is never called in my application.

function setLanguageSource(sLanguageSource) {
	$.ajax({
		dataType: 'json',
		url: sLanguageSource,
		success: function(json) {
			$.extend(true, $.fn.DataTable.defaults, {
				language: json    // Here
			});
		}
	});
	return options;
}

Can you share your code?

Angular 1.4.9 & angular datatables 0.5.5 - working
Angular 1.6.2 & angular datatables 0.6.0 - broken

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions