Skip to content

Instantly share code, notes, and snippets.

View robwormald's full-sized avatar

Rob Wormald robwormald

View GitHub Profile
//simple employee factory using Restangular
innitApp.factory('Employee',function(Restangular){
var _Employees = Restangular.all('employee')
return {
find : function(query){
var appRootState = {
name: 'app',
url: '/',
templateUrl : '/templates/innit.app.home.html'
}
var employeesRoot = {
name: 'employees',
url: '/employees',
var resolutionSystem = angular
.module('resolutionSystem', ['ui.router'])
.controller('createCaseCtrl', function($scope,Cases){
//call this from your button
$scope.saveNewCase = function(){}
Cases.createNew($kase).then(function(_savedCase){
console.log(_savedCase)
})
/**
* Global adapter config
*
* The `adapters` configuration object lets you create different global "saved settings"
* that you can mix and match in your models. The `default` option indicates which
* "saved setting" should be used if a model doesn't have an adapter specified.
*
* Keep in mind that options you define directly in your model definitions
* will override these settings.
*
/**
* parseWhereParam
*
* @param {Object} allParams [result of calling req.params.all()]
* @return {Object} the WHERE criteria object
*/
function parseWhereParam( allParams ) {
var where = req.param('where');
//factory syntax
angular.factory('myModelThingy',function($http){
//private vars
var _someThings = []
var _someOtherThings = []
app.controller('fooCtrl',function(FooFactory){
$scope.foos1 = FooFactory.getFoos();
//or
FooFactory.getFoosButDontHandlePromise().then(function(foos){
$scope.foos2 = foos;
})
api : function(req,res){
var _modelKeys = Object.keys(sails.models)
var _models = []
async.forEach(_modelKeys,function(key,done){
var _model = {
_model : key,
/**
* Employee
*
* @module :: Model
* @description :: A short summary of how this model works and what it represents.
* @docs :: http://sailsjs.org/#!documentation/models
*/
var uuid = require('node-uuid')
var http = require('http');
var querystring = require('querystring')
var url = require('url');
//pointless async function
function doAsyncMath(param1,param2,callback){