This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ParentViewCtrl | |
@$inject: ['$scope', '$location'] | |
constructor: (@scope, @location) -> | |
@scope.fun_times = @fun_times | |
@scope.some_ojects = @some_objects | |
fun_times: => | |
console.log "something something" | |
some_objects: [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
innitApp.provider('API',function(){ | |
//temp storage for new collection | |
var _collections = [] | |
//holds model references | |
var _models = {} | |
return { | |
//this fires when the provider is injected | |
$get : ['$resource',function($resource){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Find Records | |
* | |
* An API call to find and return model instances from the data adapter | |
* using the specified criteria. If an id was specified, just the instance | |
* with that unique id will be returned. | |
* | |
* @param {Integer|String} id - the unique id of the particular instance you'd like to look up | |
* @param {Object} where - the find criteria (passed directly to the ORM) | |
* @param {Integer} limit - the maximum number of records to send back (useful for pagination) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
index: function (req,res) { | |
//empty object hold the data | |
var viewData = {} | |
viewData.user = req.user; | |
File.find( function foundFiles(err, files) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in the old data model, you had to do a bunch of crufty bullshit | |
$scope.messages = Messages.all(); | |
$scope.$onRootScope('messages.updated', function() { | |
$scope.messages = Messages.all(); | |
}); | |
// ew, what's even going on there? Well, it loads the data from the Messages service, | |
// but then has to wait for an event to make sure it actually updates when the data changes. | |
// Like a peasant. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//opt 1 | |
SomeService.getStuff().then(function(stuff){ | |
return SomeService.manipulateStuff(stuff); | |
}).then(function(manipulatedStuff){ | |
//do stuff... | |
}); | |
//opt 2 | |
SomeService.getStuff().then(SomeService.manipulateStuff).then(function(manipulatedStuff){ | |
//do stuff... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// user.js | |
module.exports = { | |
schema: true, | |
attributes: { | |
name: { | |
type: 'string', | |
required: true | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var myApp = angular.module('myApp'); | |
myApp.service('Auth', function($http) { | |
this.onLoginSuccess = function(loginResponse){ | |
TokenHandler.setToken(loginResponse.data.token); | |
return ({success:1, msg: "Logged in refreshing ....", type:"success"}) | |
}, | |
this.onLoginFailure = function(loginError){ | |
return ({success:0, msg: "LError Loggin in", type:"danger"}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//bluebird promise lib >>>> anything | |
var q = require('bluebird'); | |
module.exports.bootstrap = function(cb) { | |
//returns a promise | |
var findOrCreateForm = function(){ | |
return Form.find().then(function(forms){ | |
if(forms.length > 0){ | |
return forms; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* CityController | |
* | |
* @description :: Server-side logic for managing cities | |
* @help :: See http://links.sailsjs.org/docs/controllers | |
*/ | |
module.exports = { |
OlderNewer