Skip to content

Instantly share code, notes, and snippets.

View robwormald's full-sized avatar

Rob Wormald robwormald

View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<title>innit.io</title>
<!-- Viewport mobile tag for sensible mobile support -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<!--
/**
* Module dependencies
*/
var util = require('util');
/**
* Find Records
*
/**
* AuthenticationController.js
*
* @description ::
* @docs :: http://sailsjs.org/#!documentation/controllers
*/
module.exports = {
loginForm : function(req,res){
/**
* Models
* (sails.config.models)
*
* Unless you override them, the following properties will be included
* in each of your models.
*/
var uuid = require('node-uuid')
//callbacks
Foo.find({size : 'large'},function(err,data){
if(err){ //something went wrong}
else if(data){ //found some data}
else { //no data found}
.run(['sails','ngSailsConfig','$location',function (sails,ngSailsConfig,$location) {
var launchData = $location.search()
sails.lift(ngSailsConfig,launchData)
}])
beforeCreate: function(values, done) {
if(!values.id){
values.id = uuid.v4();
}
done()
},
module.exports.policies = {
// Default policy for all controllers and actions
// (`true` allows public access)
'*': true,
// Here's an example of adding some policies to a controller
UserController: {
var async = require('async')
//async forEach
async.forEach(collection,function(item,cb){
//do something async with item
item.doSomeThing(function(err){
$stateProvider.state('app.home',{
controller : 'HomeController',
templateUrl : 'templates/home.html',
url : '/',
policies : ['authenticated']
})