I need help understanding how to call a function defined via the the swagger definition file from a service in angular using the ngDreamFactory module.
I have followed the angular Trivia App that uses the ngDreamFactory angular module. I got the angular todo example to work fine, but that does not use ngDreamFactory. I am interested in using swagger and the ngDreamFactory module.
I am trying to call getResources using the ngDreamFactory angular module but I keep getting different variants of “TypeError: Cannot read property ‘getResources’ of undefined”.
I have a service set up as “talosapi” that has this swagger definition file. (auto-generated by DF)
{
"swaggerVersion":"1.2",
"apiVersion":"1.0",
"basePath":"http://localhost:8080/rest",
"resourcePath":"/talosapi",
"produces":[
"application/json",
"application/xml"
],
"consumes":[
"application/json",
"application/xml"
],
"apis":[
{
"path":"/talosapi",
"operations":[
{
"method":"GET",
"summary":"getResources() - List all resources.",
"nickname":"getResources",
"type":"Resources",
"event_name":[
"talosapi.list"
],
"responseMessages":[
{
"code":400,
"message":"Bad Request - Request does not have a valid format, all required parameters, etc."
}, etc etc
What am I missing with regard to the Dreamfactory.api.talosapi.getResources call?
How does the notation: DreamFactory.api.(service?).(Resource?) relate to the swagger definition file. Where is this documented?
Note: I am not authenticating first because I need to integrate with an existing site, are the ngDreamFactory api functions dependent on authentication?
app.factory('profilesSvc', function($resource, DreamFactory, $q) {
function _getProfiles() {
var defer = $q.defer();
DreamFactory.api.talosapi.getResources(
function (data) {
defer.resolve(data);
},
function (data) {
defer.reject(data);
});
return defer.promise;
} etc etc..
WIth thanks
Espen