Git Product home page Git Product logo

angular-meteor's Introduction

Join the chat at https://gitter.im/Urigo/angular-meteor

The power of Meteor and the simplicity and eco-system of AngularJS

ng-conf

Quick start

Meteor Project

  1. Install Meteor $ curl https://install.meteor.com | /bin/sh
  2. Create a new meteor app using $ meteor create myapp or navigate to the root of your existing app
  3. Install Angular $ meteor add angular

Meteor client side - with Bower

Use Meteor as a service in your existing non Meteor angular application

  1. Install meteor-client-side $ bower install meteor-client-side
  2. Install angular-meteor $ bower install angular-meteor

Resources

Contributing

We would love contributions in:

  1. Code
  2. Tutorial - our goal with the tutorial is to add as many common tasks as possible. If you want to create and add your own chapter we would be happy to help you writing and adding it.
  3. Roadmap - you can add a card about what you want to see in the library or in the tutorial.
  4. I (Urigo) live around the world with one small bag, so another way of contributing can be by offering me a place to sleep somewhere interesting around the world that I have to see :)

If you want to contribute and need help or don't know what should you do, you can contact me directly

Contributor Developer Setup

Run local angular-meteor in your project

Create your Meteor Project

meteor create myProject
cd myProject

Fork angular-meteor and clone the angular-meteor library to another directory named angular

mkdir angular
git clone https://github.com/[your_username]/angular-meteor.git angular

Create a packages directory under your project's root folder and link your forked repo

cd myProject
mkdir packages
cd packages
ln -s ~/path_to_your_repos/angular

Now you can start using your own copy of the angular-meteor project from myProject.

Running tests

In the command line

. run_tests.sh

Then go to localhost:3000 in your browser

Contributing to documentation and tutorials.

Whether it's a typo, some clarification, or a whole new feature - here's how to get started:

  1. Follow the steps to get started as a developer for angular-meteor.
  2. Change into the .docs directory and then angular-meteor cd .docs/angular-meteor
  3. Run the app for the documentation meteor
  4. Start tweaking and updating!

Usage

Table of Contents

App initialization

Register angular-meteor as a module in our application:

angular
  .module('myModule', ['angular-meteor']);

More in step 0 in the tutorial

Templating

You need to write your Angular template markup in .ng.html files, since Meteor won't look at those files as Spacebars templates. Tying HTML and .ng.html files together isn't very difficult, we can simply use Angular's ng-include.

Please note that the names of the templates to Angular will be their URL as Meteor sees it when minifying the '.ng.html' files. Hence every template URL is relative to the root of the Meteor project, and contains no leading forward slash. This is important to note when working with ng-include to include templates.

client/index.html:

<head>
    <title>Angular and Meteor</title>
</head>

<body ng-app="myModule">
    <ng-include src="'client/views/user.ng.html'"></ng-include>
    <ng-include src="'client/views/settings.ng.html'"></ng-include>
</body>

client/views/user.ng.html:

<div>
    <label>Name:</label>
    <input type="text" ng-model="yourName" placeholder="Enter a name here">

    <h1>Hello {{yourName}}!</h1>
</div>

More in step 0 of the tutorial

Binding to Meteor Collections

angular-meteor provides 3-way data binding (view-client-server) by tying a Meteor collection to an Angular model. The API to accomplish this is $meteor.collection.

$scope.todos = $meteor.collection(Todos);

More in step 3 of the tutorial

Subscribe

$meteor.subscribe is a wrapper for Meteor.subscribe that returns a promise.

Here's an example of how to tie a Meteor collection to a clean Angular model in the form of an array:

$meteor.subscribe('Todos').then(function () {
    $scope.todos = $meteor.collection(Todos);
});

More in step 9 of the tutorial

Routing

Use to official AngularUI ui-router Meteor package - angularui:angular-ui-router

More on how to actually use angular-ui-router in step 5 of the tutorial

<blaze-template>

Include Blaze templates in your angular-meteor application.

Use the urigo:angular-blaze-template package.

User Authentication

angular-meteor provides complete support for the Meteor accounts system. more details here - Documentation.

More in step 8 of the tutorial

Meteor methods with promises

$meteor.call calls a Meteor method and returns a promise.

$meteor.call('addUser', username).then(function (data) {
    console.log('User added', data);
});

More in step 14 of the tutorial

Bind Meteor session

$meteor.session binds a scope variable to a Meteor Session variable.

$meteor.session('counter').bind($scope, 'counter');

Additional packages

The following is a non-exhaustive list of Meteor packages common Angular libraries:

Feel free to make more Angular packages and add them to that list as well.

Acknowledgement

This project started as ngMeteor, a pre-0.9 meteorite package. Since then a lot has changed but that was the main base.

Also, a lot of features were inspired by @superchris's angular-meteor fork of ngMeteor

angular-meteor's People

Contributors

barbatus avatar blevinscm avatar braincrumbz avatar ccortezia avatar dab0mb avatar davidyaha avatar dotansimha avatar dotob avatar emmn avatar epotvin avatar fredrikekelund avatar idanwe avatar igorminar avatar leoetlino avatar loneleeandroo avatar markleusink avatar milosstanic avatar modcoms avatar netanelgilad avatar nieziemski avatar okland avatar oshai avatar pbastowski avatar peterhb999 avatar rjsmith avatar shmck avatar simonv3 avatar smoke avatar tallyb avatar urigo avatar

Watchers

 avatar  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.