Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added discussion

  • Loading branch information...
commit a186fcc37bf5aea29c54dc976585e18219ad9891 1 parent f96003b
@seanhess authored
Showing with 14 additions and 5 deletions.
  1. +9 −3 README.md
  2. +5 −2 public/js/app.js
View
12 README.md
@@ -4,7 +4,7 @@ The Issues: An AngularJS Demo Application
This vs That demo application written in AngularJS. This was prepared for a UtahJS presentation. This Readme is equivalent to slide deck.
Demo: http://the-issues.herokuapp.com/
-
+Discuss: http://news.ycombinator.com/item?id=4488847
About Me
--------
@@ -174,8 +174,9 @@ We add a .create method on our scope
// ...
$scope.create = function() {
issue = {first: {name: $scope.firstOption}, second: {name: $scope.secondOption}}
- Issues.save(issue)
- $scope.issues = Issues.query()
+ Issues.save(issue, function() {
+ $scope.issues = Issues.query()
+ })
}
}
@@ -409,3 +410,8 @@ Other Resources
* [AngularJS Tutorial](http://docs.angularjs.org/tutorial/)
* [Google Group](https://groups.google.com/forum/?fromgroups#!forum/angular)
+
+Discuss
+-------
+
+http://news.ycombinator.com/item?id=4488847
View
7 public/js/app.js
@@ -35,13 +35,15 @@ var app = angular.module('app', ['ngResource'], function($routeProvider) {
function IssuesController($scope, Issues, Auth) {
+ // If you didn't want realtime updates, you would use Issues.query()
$scope.issues = Issues.pollList(1000)
$scope.auth = Auth
$scope.create = function() {
issue = {first: {name: $scope.firstOption}, second: {name: $scope.secondOption}}
- Issues.save(issue)
- $scope.issues = Issues.query()
+ Issues.save(issue, function() {
+ $scope.issues = Issues.query()
+ })
}
};
@@ -52,6 +54,7 @@ function IssueDetailsController($scope, Issues, $routeParams, Auth) {
$scope.issueId = $routeParams._id
$scope.auth = Auth
+ // If you didn't want realtime updates, you would use Issues.get({_id:...})
$scope.issue = Issues.pollIssue({_id: $routeParams._id}, 1000)
$scope.vote = function(option) {
Please sign in to comment.
Something went wrong with that request. Please try again.