A Pen by Nizar Oukhchi on CodePen.
This file contains 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
/* app/server/api/model/model.controller.js */ | |
var Model = require('./model'); | |
var ioEmitter = require('../../config/sockets'); | |
exports.create = function (req, res) { | |
Model.create(req.body, function (err, model) { | |
if (err) { | |
return res.status(500).send(err); | |
} |
This file contains 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
/* app/server/server.js */ | |
var express = require('express'); | |
var config = require('./config/environment'); | |
var mongoose = require('mongoose'); | |
mongoose.connect(config.mongo.uri, config.mongo.options); | |
var app = express(); |
This file contains 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
/* app/server/config/sockets.js */ | |
var config = require('./environment'); | |
var redis = require('redis'); | |
var initialized = false; | |
var ioEmitter; | |
var redisClient = redis.createClient(config.redis.url, {return_buffers: true}); | |
var pub = redis.createClient(config.redis.url); |
This file contains 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
/* app/server/api/model/model.controller.js */ | |
var Model = require('./model'); | |
exports.create = function (req, res) { | |
Model.create(req.body, function (err, model) { | |
if (err) { | |
return res.status(500).send(err); | |
} | |
// "broadcaster" le model crée a tout le monde via socket.io |
This file contains 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
(function() {var a = document.createElement("script");a.src = "https://rawgithub.com/kentcdodds/ng-stats/master/dist/ng-stats.js";a.onload=function(){window.showAngularStats()};document.head.appendChild(a)})(); |
This file contains 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 service = prompt('Service name'); console.log(window[service] = angular.element('[ng-app], [data-ng-app]').injector().get(service)); |
This file contains 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
document.body.onclick = function(event){window.scope = angular.element(event.target).scope();console.log(window.scope);document.body.onclick = null;} |
This file contains 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
angular.module('myApp', []) | |
.controller('appCtrl', function($scope){ | |
}); |