I am following the HotTowel Angular course by John Papa with the latest Hot Towel version 2.1.0, however I am getting an Error "config is not defined" occurring when my query is executed.
function getServerPartials() {
var orderBy = 'Activated, Label, Serial, IsActive';
var servers;
return EntityQuery.from('Servers')
.select('ServerId, Name, Serial, Activated, IsActive')
.orderBy(orderBy)
.toType('Server')
.using(manager).execute()
.to$q(querySucceeded, _queryFailed);
function querySucceeded(data) {
servers = data.results;
log('Retrieved [Server Partials] from remote data source', servers.length, true);
return servers;
}
}
function _queryFailed(error) {
var msg = config.appErrorPrefix + 'Error retreiving data.' + error.message;
logError(msg, error);
throw error;
}
app.run(['$route','config.breeze', function ($route) {
// Include $route to kick start the router.
}]);
The error has to do with the .to$q(querySucceeded, _queryFailed); do I have to add something in the app section as I know breeze.to$q library is no longer needed or present.
Your getServerPartials
function uses config
which is an angular service in the app. You need to inject config in your factory, controller, directive, whatever. Otherwise you get this issue. I do not see what type of object the function is contained within. In other words ... if its wrapped in a factory, inject config.