Step 0 - start
- Run
ionic start chat blank
Step 1 - chat view
- Run
ionic setup sass
- Run
npm install
- Add chat template and CtrlController
Step 2 - Connect to meteor server
- Run
meteor create server
- Replace
server.js
code withMessages = new Meteor.Collection('messages');
- Run
bower install meteor-client-side angular-meteor
- Add to
index.html
<script src="lib/meteor-client-side/meteor-runtime-config.js"></script>
<script src="lib/meteor-client-side/dist/meteor-client-side.bundle.min.js"></script>
<script src="lib/angular-meteor/dist/angular-meteor.bundle.min.js"></script>
- Add
Messages = new Meteor.Collection('messages');
to the client - Assign angular meteor collection to $scope
$scope.messages = $scope.$meteorCollection(Messages);
- Run the app:
ionic serve
&&cd server && meteor
Step 3 - Users
In the server:
- Run
meteor add accounts-password
In the client:
- Run
bower install accounts-password-client-side
- Add to
index.html
<script src="lib/accounts-base-client-side/dist/accounts-base-client-side.bundle.min.js"></script>
<script src="lib/accounts-password-client-side/dist/accounts-password-client-side.bundle.min.js"></script>
<script src="lib/angular-meteor.bundle.min.js"></script>
- Add login, register and logout
- Add to message wrapper div (
.message-list
)ng-if="$root.currentUser
- Add
currentUser._id
to message
Step 4 - methods and publish
- Run
metoer remove insecure autopublish
- Add
sendMessage
method at the server and at the client (the photo can demonstarate the optemistic ui) - Add pubish and subscribe 'messages'