I have an object that contains a resource. When I use this resource to make requests in most parts of an application, and it works fine. However, inside of a function that gets called due to an event in a directive (jQuery draggable and droppable, event fires when an element is dropped), the resource will not fire a request. Why is this? Is there a workaround or fix?
Example:
//function called by directive
Project.appendTemplate = function(project, tID) {
console.log('appendTemplate Called'); //this happens
Template.resource.get({'ID' : 1}, function(result) {
console.log('hello'); //this does not
});
}
//called when this service is loaded
Template.resource.get({'ID' : 1}, function(result) {
console.log('hello'); //happens
});