title: Ionic Demo author: name: Tom Wilson twitter: twilson63 url: http://www.jackhq.com output: index.html controls: true
--
--
mobile framework for building cordova/phonegap applications using AngularJS
--
Tour of Docs
--
Today we are going to build a simple IonicApp
Receipt Mgr
--
git clone https://github.com/twilson63/receipt-mgr.git
--
npm install atomify -g
npm install bower -g
npm install
--
npm start
--
- html
- javascript
- css
--
- Build New Form
- Build List View
- Build Show View
** Controllers are in place we just need to do the ionic **
--
vim app/receipts/new/receipt-new.html
Create a form that captures the following:
- Current Location
- Total Amt
- Notes
--
<ion-view title="New Receipt">
<ion-content class="has-header">
<div class="list list-inset">
<div class="item">
<h1>New Receipt</h1>
<p>Document your receipt by taking a photo of the receipt and
adding the amount to the form.
</p>
</div>
<label class="item item-input">
<input type="text" placeholder="location" ng-model="receipt.location">
</label>
<label class="item item-input">
<input type="number" placeholder="amount" ng-model="receipt.amount">
</label>
<label class="item item-input">
<textarea placeholder="notes" style="height: 200px;" ng-model="receipt.notes"></textarea>
</label>
<button class="item button button-block button-balanced" ng-click="save(receipt)">Save</button>
</div>
</ion-content>
</ion-view>
--
vim app/receipts/list/receipts-list.html
Create a view that lists the receipts in descending order
--
<ion-view title="Receipts">
<ion-content class="has-header">
<ion-list>
<ion-item ng-repeat="receipt in receipts" type="item-text-wrap"
ui-sref="receipts.show({id: receipt._id})">
{{receipt.location}}
</ion-item>
</ion-list>
</ion-content>
</ion-view>
--
vim app/receipts/show/receipt-show.html
Create a multi-tab show page that shows the photo, a map, and the amount and notes of the receipt.
--
<ion-view title="Receipt">
<ion-content class="has-header">
<ion-list>
<ion-item>
<h1>Receipt</h1>
</ion-item>
<ion-item>
<label>Location</label>
<div>{{receipt.location}}</div>
</ion-item>
<ion-item>
<label>Amount</label>
<div>{{receipt.amount | currency}}</div>
</ion-item>
<ion-item>
<label>Notes</label>
<div>{{receipt.notes}}</div>
</ion-item>
<ion-item>
<a class="button button-block" ui-sref="receipts.list">Ok</a>
</ion-item>
</ion-list>
</ion-content>
</ion-view>
--
cordova build ios
--
cordova emulate ios
--
fin