Coder Social home page Coder Social logo

angular-sails-socketio-mongo-demo's Introduction

Angular + Sails + Socket.io + MongoDB Demo

A simple CRUD example of using AngularJS with SailsJS. It uses Angular Resource to interface with the Sails REST back-end Api and also includes some socket.io interaction on the front-end. There is some basic authentication and also a few nifty directives for loading gravatars via email address and form password validation. Enjoy!

Install

git clone [email protected]:levid/angular-sails-socketio-mongo-demo.git
cd angular-sails-socketio-mongo-demo
npm install

You will want to configure your Mongo DB in config/adapters.js

mongo: {
  module   : 'sails-mongo',
  url      : 'mongodb://localhost:27017/YOUR_DB_NAME'
}

Then to start the server on port 1337 run:

sails lift

Partials (inlined)

Partials can either be inlined into the main html page by dumping partials into the assets/templates folder, your partial should look like this:

<script type="text/ng-template" id="partial1.html">
  <h1>View 1</h1>
  <p>foo = {{foo}}</p>
</script>

You can also create sub folders within the templates folder to keep things more organized. Just make sure to reference the path relative to your templates folder like this:

<script type="text/ng-template" id="partials/partial1.html">
  <h1>View 1</h1>
  <p>foo = {{foo}}</p>
</script>

then include the line below in your main html body (this will concatenate and inject all the partials into the page):

<%- assets.templateLibrary() %>

Your when statement in your angular routeprovider would look like this :

when('/view1', {templateUrl: 'partial1.html'}).

where partial1.html would be the id specified in your partial

Partials (remote)

Partials can also be served from the server by dumping your plain html partials into assets/templates/partials (note though that if you include the assets.templateLibrary() line from above - the partials in this folder will still be injected into the page)

Your when statement in your angular routeprovider - in this case - would look like this :

when('/view1', {templateUrl: '/template/find/partial1.html'}).

(this uses the api/controller/TemplateController.js to serve up a partial by name)

angular-sails-socketio-mongo-demo's People

Contributors

kamilski81 avatar levid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

angular-sails-socketio-mongo-demo's Issues

Error when following instructions: version conflict

Error: Cannot find module '/Users/kmandrup/private/angular-projects/angular-sails-crud/node_modules/sails/lib'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at liftSails (/usr/local/lib/node_modules/sails/bin/lift.js:98:7)

However there IS a folder /Users/kmandrup/private/angular-projects/angular-sails-crud/node_modules/sails/lib

Looks like it uses my globally installed Sails 0.9.7 and looks for a file locally which is "out of sync"? i.e version conflict, which others also have commented on

error rendering layout.ejs

well, I'm new in sails and angular... and i try to understand how to works this tools together. after I ran a
sail lift
and I open: http://localhost:1337/

I get this:
{
"path": "/workspace/javaScript/angular-sails-socketio-mongo-demo/views/layout.ejs"
}

and in the logs appers this error:

verbose: Running res.view() method...
error: Error rendering view at :: /workspace/javaScript/angular-sails-socketio-mongo-demo/views/home/index
error: Using layout located at :: /workspace/javaScript/angular-sails-socketio-mongo-demo/views/layout.ejs

any Idea about what is happening?

Remove node_modules from repository

The node_modules directory should not be included as it is generated via "npm install". Additionally, it adds ~21 MB (!) to the repo size.

While you're cleaning up the repo please remove the .gitkeep-files from non-empty directories.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.