Skip to content

Instantly share code, notes, and snippets.

@whisher
Last active August 29, 2015 14:00
Show Gist options
  • Save whisher/11401451 to your computer and use it in GitHub Desktop.
Save whisher/11401451 to your computer and use it in GitHub Desktop.
angular.module('mean.system')
.factory('Menus', ['$http','$q', function($http,$q) {
return {
get : function(name,defaultMenu){
var deferred = $q.defer();
$http.get('/admin/menu/'+name, {
params: {
defaultMenu: defaultMenu
}
})
.success(function (response) {
deferred.resolve(response);
})
.error(function() {
deferred.reject('Unable to get menu');
});
return deferred.promise;
}
};
}]);
UPDATE
angular.module('mean.system')
.factory('Menus', ['$http','$q', function($http,$q) {
return {
get : function(name,defaultMenu){
console.log(defaultMenu);
var deferred = $q.defer();
$http.get('/admin/menu/'+name, {
params: {
'defaultMenu[]': defaultMenu
}
})
.success(function (response) {
deferred.resolve(response);
})
.error(function() {
deferred.reject('Unable to get menu');
});
return deferred.promise;
}
};
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment