├── .gitignore ├── .idea └── .name ├── .meteor ├── .finished-upgraders ├── .gitignore ├── .id ├── packages ├── platforms ├── release └── versions ├── README.md ├── client ├── controllers │ ├── mainCtrl.js │ └── postsCtrl.js ├── index.html ├── lib │ └── app.js ├── routes.js ├── styles │ └── style.css └── views │ ├── home.ng.html │ └── posts.ng.html └── posts.js /.gitignore: -------------------------------------------------------------------------------- 1 | .idea -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | Thinkster-MEAN-Tutorial-in-angular-meteor -------------------------------------------------------------------------------- /.meteor/.finished-upgraders: -------------------------------------------------------------------------------- 1 | # This file contains information which helps Meteor properly upgrade your 2 | # app when you run 'meteor update'. You should check it into version control 3 | # with your project. 4 | 5 | notices-for-0.9.0 6 | notices-for-0.9.1 7 | 0.9.4-platform-file 8 | notices-for-facebook-graph-api-2 9 | -------------------------------------------------------------------------------- /.meteor/.gitignore: -------------------------------------------------------------------------------- 1 | local 2 | -------------------------------------------------------------------------------- /.meteor/.id: -------------------------------------------------------------------------------- 1 | # This file contains a token that is unique to your project. 2 | # Check it into your repository along with the rest of this directory. 3 | # It can be used for purposes such as: 4 | # - ensuring you don't accidentally deploy one app on top of another 5 | # - providing package authors with aggregated statistics 6 | 7 | zf24vp1hthxuihm81ff 8 | -------------------------------------------------------------------------------- /.meteor/packages: -------------------------------------------------------------------------------- 1 | # Meteor packages used by this project, one per line. 2 | # Check this file (and the other files in this directory) into your repository. 3 | # 4 | # 'meteor add' and 'meteor remove' will edit this file for you, 5 | # but you can also edit it by hand. 6 | 7 | meteor-platform 8 | autopublish 9 | urigo:angular 10 | angularui:angular-ui-router 11 | twbs:bootstrap 12 | accounts-password 13 | accounts-ui 14 | -------------------------------------------------------------------------------- /.meteor/platforms: -------------------------------------------------------------------------------- 1 | server 2 | browser 3 | -------------------------------------------------------------------------------- /.meteor/release: -------------------------------------------------------------------------------- 1 | METEOR@1.0.5 2 | -------------------------------------------------------------------------------- /.meteor/versions: -------------------------------------------------------------------------------- 1 | accounts-base@1.2.0 2 | accounts-password@1.1.0 3 | accounts-ui@1.1.5 4 | accounts-ui-unstyled@1.1.7 5 | angularjs:angular@1.3.15 6 | angularui:angular-ui-router@0.2.13_3 7 | autopublish@1.0.3 8 | autoupdate@1.2.0 9 | base64@1.0.3 10 | binary-heap@1.0.3 11 | blaze@2.1.0 12 | blaze-tools@1.0.3 13 | boilerplate-generator@1.0.3 14 | callback-hook@1.0.3 15 | check@1.0.5 16 | dburles:mongo-collection-instances@0.3.3 17 | ddp@1.1.0 18 | deps@1.0.7 19 | ejson@1.0.6 20 | email@1.0.6 21 | fastclick@1.0.3 22 | geojson-utils@1.0.3 23 | html-tools@1.0.4 24 | htmljs@1.0.4 25 | http@1.1.0 26 | id-map@1.0.3 27 | jquery@1.11.3_2 28 | json@1.0.3 29 | lai:collection-extensions@0.1.3 30 | launch-screen@1.0.2 31 | less@1.0.13 32 | livedata@1.0.13 33 | localstorage@1.0.3 34 | logging@1.0.7 35 | meteor@1.1.5 36 | meteor-platform@1.2.2 37 | minifiers@1.1.4 38 | minimongo@1.0.7 39 | mobile-status-bar@1.0.3 40 | mongo@1.1.0 41 | npm-bcrypt@0.7.8_1 42 | observe-sequence@1.0.5 43 | ordered-dict@1.0.3 44 | random@1.0.3 45 | reactive-dict@1.1.0 46 | reactive-var@1.0.5 47 | reload@1.1.3 48 | retry@1.0.3 49 | routepolicy@1.0.5 50 | service-configuration@1.0.4 51 | session@1.1.0 52 | sha@1.0.3 53 | spacebars@1.0.6 54 | spacebars-compiler@1.0.5 55 | srp@1.0.3 56 | templating@1.1.0 57 | tracker@1.0.6 58 | twbs:bootstrap@3.3.4 59 | ui@1.0.6 60 | underscore@1.0.3 61 | urigo:angular@0.8.2 62 | url@1.0.4 63 | webapp@1.2.0 64 | webapp-hashing@1.0.3 65 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Thinkster's MEAN Tutorial in angular-meteor 2 | angular-meteor version of [Thinkster.io's mean-stack-tutorial](https://thinkster.io/mean-stack-tutorial/) 3 | -------------------------------------------------------------------------------- /client/controllers/mainCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('flapperNews').controller('MainCtrl', ['$scope', '$meteor', '$rootScope', 2 | function($scope, $meteor, $rootScope){ 3 | $scope.test = 'Hello world!'; 4 | 5 | $scope.posts = $meteor.collection(Posts); 6 | 7 | $scope.addPost = function(){ 8 | if($scope.title === '') { return; } 9 | if(!$rootScope.currentUser) { return; } 10 | $scope.posts.push({ 11 | owner: $rootScope.currentUser._id, 12 | title: $scope.title, 13 | link: $scope.link, 14 | upvotes: 0 15 | }); 16 | $scope.title = ''; 17 | $scope.link = ''; 18 | }; 19 | 20 | $scope.incrementUpvotes = function(post) { 21 | post.upvotes++; 22 | }; 23 | 24 | }]); -------------------------------------------------------------------------------- /client/controllers/postsCtrl.js: -------------------------------------------------------------------------------- 1 | angular.module('flapperNews').controller('PostsCtrl', [ 2 | '$scope', 3 | '$meteor', 4 | '$stateParams', 5 | '$rootScope', 6 | function($scope, $meteor, $stateParams, $rootScope){ 7 | $scope.post = $meteor.object(Posts, $stateParams.id); 8 | 9 | $scope.addComment = function(){ 10 | if($scope.body === '') { return; } 11 | if (!$scope.post.comments) 12 | $scope.post.comments = []; 13 | $scope.post.comments.push({ 14 | body: $scope.body, 15 | author: $rootScope.currentUser.emails[0].address, 16 | upvotes: 0 17 | }); 18 | $scope.body = ''; 19 | }; 20 | 21 | $scope.incrementUpvotes = function(comment){ 22 | comment.upvotes++; 23 | }; 24 | }]); -------------------------------------------------------------------------------- /client/index.html: -------------------------------------------------------------------------------- 1 | 2 | Flapper News 3 | 4 | 5 | 6 | {{> loginButtons }} 7 |
8 |
9 | 10 |
11 |
12 | -------------------------------------------------------------------------------- /client/lib/app.js: -------------------------------------------------------------------------------- 1 | angular.module('flapperNews', ['angular-meteor', 'ui.router']); -------------------------------------------------------------------------------- /client/routes.js: -------------------------------------------------------------------------------- 1 | angular.module('flapperNews').config(['$stateProvider', '$urlRouterProvider', 2 | function($stateProvider, $urlRouterProvider) { 3 | 4 | $stateProvider 5 | .state('home', { 6 | url: '/home', 7 | templateUrl: 'client/views/home.ng.html', 8 | controller: 'MainCtrl' 9 | }) 10 | .state('posts', { 11 | url: '/posts/{id}', 12 | templateUrl: 'client/views/posts.ng.html', 13 | controller: 'PostsCtrl' 14 | }); 15 | 16 | $urlRouterProvider.otherwise('home'); 17 | }]); -------------------------------------------------------------------------------- /client/styles/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding: 50px; 3 | font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; 4 | } 5 | 6 | a { 7 | color: #00B7FF; 8 | } -------------------------------------------------------------------------------- /client/views/home.ng.html: -------------------------------------------------------------------------------- 1 | 4 | 5 |
6 | 8 | {{post.upvotes}} 9 | 10 | 11 | {{post.title}} 12 | 13 | 14 | {{post.title}} 15 | 16 | 17 | 18 | posted by {{post.author}} | 19 | 20 | 21 | Comments 22 | 23 |
24 | 25 |
27 |

Add a new post

28 | 29 |
30 | 34 |
35 |
36 | 40 |
41 | 42 |
43 | 44 |
45 |

You need to Log In or Register before you can add a post.

46 |
-------------------------------------------------------------------------------- /client/views/posts.ng.html: -------------------------------------------------------------------------------- 1 | 11 | 12 |
13 | 15 | {{comment.upvotes}} - by {{comment.author}} 16 | 17 | {{comment.body}} 18 | 19 |
20 |
22 |

Add a new comment

23 | 24 |
25 | 29 |
30 | 31 |
32 | 33 |
34 |

You need to Log In or Register before you can add a post.

35 |
36 | -------------------------------------------------------------------------------- /posts.js: -------------------------------------------------------------------------------- 1 | Posts = new Mongo.Collection("posts"); 2 | 3 | Posts.allow({ 4 | insert: function (userId, post) { 5 | return userId && post.owner === userId; 6 | }, 7 | update: function (userId, post, fields, modifier) { 8 | if (userId !== post.owner) 9 | return false; 10 | 11 | return true; 12 | }, 13 | remove: function (userId, post) { 14 | if (userId !== post.owner) 15 | return false; 16 | 17 | return true; 18 | } 19 | }); --------------------------------------------------------------------------------