Closed susanm74 closed 5 years ago
Ooh, so I think I figured out the issue!
this controller syntax works:
angular.module('myApp').controller('myAppController',
function myAppController($scope, gettextCatalog) {
// do some stuff with gettextCatalog
});
but THIS controller syntax does NOT work:
var app = angular.module('myApp');
app.controller('myAppController', ['$scope', 'gettext', myAppController]);
function myAppController($scope, gettextCatalog) {
// do some stuff with gettextCatalog
}
Hope this helps anyone else running into the same issue!
app.controller('myAppController', ['$scope', 'gettext', myAppController]); function myAppController($scope, gettextCatalog) {
That's because you have a mismatch between the inject spec and what you try to use. You're injecting gettext
, which is not the gettextCatalog
you want.
Not a bug really, more a programmer error. Glad you figured it out!
Yep yep!
this controller syntax works:
var app = angular.module('myApp');
app.controller('myAppController', ['$scope', 'gettextCatalog', myAppController]);
function myAppController($scope, gettextCatalog) {
// do some stuff with gettextCatalog
}
Thanks for the clarification!
I followed this tutorial* without any issue, up until when I tried to call "gettextCatalog.setCurrentLanguage('sw')" in my $scope.changeLanguage function, which is when I get the following console error: "TypeError: gettextCatalog.setCurrentLanguage is not a function"
*tutorial originally found via this stackoverflow article