GithubHelp home page GithubHelp logo

hhy5277 / angular-sails-socketio-mongo-demo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from levid/angular-sails-socketio-mongo-demo

0.0 1.0 0.0 22.93 MB

AngularJS, SailsJS, Socket.io & MongoDB Demo

JavaScript 72.55% CoffeeScript 7.00% CSS 3.55% HTML 16.90%

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

Watchers

 avatar

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.