Momentum.build Petition module for Angular
Before starting:
Make sure you go to http://www.momentum.build to create your campaigns and actions to use with this module.
Use (Simple):
1. bower install momentum-actions --save
2. Add angular, actions.js (and actions-tpl.js if you want to use example templates) as scripts in your html
``` <script src="bower_components/angular/angular.min.js"></script> <script src="bower_components/dist/actions.min.js"></script> <script src="bower_components/dist/actions-tpl.min.js"></script> ```3. Add 'momentum.actions' as dependancy to app module.
``` angular.module('actionExample', ['momentum.actions']) ```4. call directive with campaign and action id's.
``` ```Use (Custom):
Custom uncompiled example located in 'src/example'. Uses gulp and jade and compiles to 'example/' folder.
<actions-feed campaign-id="48" action-id="42" action="petition">
<div data-ng-repeat="a in Feed.actions | orderBy:'-createdAt'" class="actionItem">
<p><b>{{ a.first_name }} said</b> {{ a.message}}<small class="clearfix">at {{ a.createdAt | date : 'medium' }}</small></p>
</div>
</actions-feed>
<actions-form campaign-id="48" action-id="42" action="petition">
<form id="actionForm" data-ng-submit="Form.create()">
<div class="form-group">
<input type="text" data-ng-model="Form.newAction.first_name" data-ng-required="true" placeholder="First Name" class="form-control">
</div>
<div class="form-group">
<textarea data-ng-model="Form.newAction.message" data-ng-required="true" placeholder="Message" class="form-control"></textarea>
</div>
<button class="btn btn-success btn-block btn-lg">Sign Action</button>
</form>
</actions-form>
API's:
Feed directive example (use templateUrl instead of transclusion)
Form directive example (use templateUrl instead of transclusion)
Angular factory for API endpoints