forked from Urigo/angular-meteor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
angular-meteor.js
62 lines (60 loc) · 2.68 KB
/
angular-meteor.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Define angular-meteor and its dependencies
var angularMeteor = angular.module('angular-meteor', [
'angular-meteor.subscribe',
'angular-meteor.collection',
'angular-meteor.object',
'angular-meteor.template',
'angular-meteor.user',
'angular-meteor.methods',
'angular-meteor.session',
'angular-meteor.reactive-scope',
'angular-meteor.utils',
'angular-meteor.camera',
'hashKeyCopier'
]);
angularMeteor.run(['$compile', '$document', '$rootScope', function ($compile, $document, $rootScope) {
// Recompile after iron:router builds page
if(typeof Router != 'undefined') {
var appLoaded = false;
Router.onAfterAction(function(req, res, next) {
Tracker.afterFlush(function() {
if (!appLoaded) {
$compile($document)($rootScope);
if (!$rootScope.$$phase) $rootScope.$apply();
appLoaded = true;
}
})
});
}
}]);
// Putting all services under $meteor service for syntactic sugar
angularMeteor.service('$meteor', ['$meteorCollection', '$meteorCollectionFS', '$meteorObject', '$meteorMethods', '$meteorSession', '$meteorSubscribe', '$meteorUtils', '$meteorCamera', '$meteorUser',
function($meteorCollection, $meteorCollectionFS, $meteorObject, $meteorMethods, $meteorSession, $meteorSubscribe, $meteorUtils, $meteorCamera, $meteorUser){
this.collection = $meteorCollection;
this.collectionFS = $meteorCollectionFS;
this.object = $meteorObject;
this.subscribe = $meteorSubscribe.subscribe;
this.call = $meteorMethods.call;
this.loginWithPassword = $meteorUser.loginWithPassword;
this.requireUser = $meteorUser.requireUser;
this.requireValidUser = $meteorUser.requireValidUser;
this.waitForUser = $meteorUser.waitForUser;
this.createUser = $meteorUser.createUser;
this.changePassword = $meteorUser.changePassword;
this.forgotPassword = $meteorUser.forgotPassword;
this.resetPassword = $meteorUser.resetPassword;
this.verifyEmail = $meteorUser.verifyEmail;
this.loginWithMeteorDeveloperAccount = $meteorUser.loginWithMeteorDeveloperAccount;
this.loginWithFacebook = $meteorUser.loginWithFacebook;
this.loginWithGithub = $meteorUser.loginWithGithub;
this.loginWithGoogle = $meteorUser.loginWithGoogle;
this.loginWithMeetup = $meteorUser.loginWithMeetup;
this.loginWithTwitter = $meteorUser.loginWithTwitter;
this.loginWithWeibo = $meteorUser.loginWithWeibo;
this.logout = $meteorUser.logout;
this.logoutOtherClients = $meteorUser.logoutOtherClients;
this.session = $meteorSession;
this.autorun = $meteorUtils.autorun;
this.getCollectionByName = $meteorUtils.getCollectionByName;
this.getPicture = $meteorCamera.getPicture;
}]);